[前][次][番号順一覧][スレッド一覧]

ruby-changes:48411

From: eregon <ko1@a...>
Date: Sun, 29 Oct 2017 00:16:02 +0900 (JST)
Subject: [ruby-changes:48411] eregon:r60525 (trunk): Update to ruby/spec@a6b8805

eregon	2017-10-29 00:15:48 +0900 (Sun, 29 Oct 2017)

  New Revision: 60525

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60525

  Log:
    Update to ruby/spec@a6b8805

  Added directories:
    trunk/spec/ruby/core/tracepoint/
    trunk/spec/ruby/core/tracepoint/fixtures/
    trunk/spec/ruby/core/warning/
    trunk/spec/ruby/library/optionparser/
  Added files:
    trunk/spec/ruby/core/array/pack/buffer_spec.rb
    trunk/spec/ruby/core/array/sum_spec.rb
    trunk/spec/ruby/core/complex/finite_spec.rb
    trunk/spec/ruby/core/complex/infinite_spec.rb
    trunk/spec/ruby/core/dir/empty_spec.rb
    trunk/spec/ruby/core/false/dup_spec.rb
    trunk/spec/ruby/core/file/empty_spec.rb
    trunk/spec/ruby/core/float/dup_spec.rb
    trunk/spec/ruby/core/integer/digits_spec.rb
    trunk/spec/ruby/core/integer/dup_spec.rb
    trunk/spec/ruby/core/integer/shared/integer_rounding.rb
    trunk/spec/ruby/core/integer/sqrt_spec.rb
    trunk/spec/ruby/core/main/fixtures/string_refinement.rb
    trunk/spec/ruby/core/main/fixtures/string_refinement_user.rb
    trunk/spec/ruby/core/main/using_spec.rb
    trunk/spec/ruby/core/module/fixtures/refine.rb
    trunk/spec/ruby/core/module/fixtures/using.rb
    trunk/spec/ruby/core/module/refine_spec.rb
    trunk/spec/ruby/core/module/using_spec.rb
    trunk/spec/ruby/core/nil/dup_spec.rb
    trunk/spec/ruby/core/numeric/finite_spec.rb
    trunk/spec/ruby/core/numeric/infinite_spec.rb
    trunk/spec/ruby/core/string/unpack1_spec.rb
    trunk/spec/ruby/core/symbol/dup_spec.rb
    trunk/spec/ruby/core/thread/report_on_exception_spec.rb
    trunk/spec/ruby/core/tracepoint/callee_id_spec.rb
    trunk/spec/ruby/core/tracepoint/fixtures/classes.rb
    trunk/spec/ruby/core/true/dup_spec.rb
    trunk/spec/ruby/core/warning/warn_spec.rb
    trunk/spec/ruby/language/fixtures/binary_symbol.rb
    trunk/spec/ruby/library/conditionvariable/marshal_dump_spec.rb
    trunk/spec/ruby/library/csv/liberal_parsing_spec.rb
    trunk/spec/ruby/library/date/friday_spec.rb
    trunk/spec/ruby/library/date/monday_spec.rb
    trunk/spec/ruby/library/date/saturday_spec.rb
    trunk/spec/ruby/library/date/sunday_spec.rb
    trunk/spec/ruby/library/date/thursday_spec.rb
    trunk/spec/ruby/library/date/tuesday_spec.rb
    trunk/spec/ruby/library/date/wednesday_spec.rb
    trunk/spec/ruby/library/optionparser/order_spec.rb
    trunk/spec/ruby/library/optionparser/parse_spec.rb
    trunk/spec/ruby/library/pathname/empty_spec.rb
    trunk/spec/ruby/library/rexml/element/element_reference_spec.rb
    trunk/spec/ruby/library/set/compare_by_identity_spec.rb
    trunk/spec/ruby/library/time/to_time_spec.rb
  Modified files:
    trunk/spec/ruby/.rubocop.yml
    trunk/spec/ruby/.rubocop_todo.yml
    trunk/spec/ruby/.travis.yml
    trunk/spec/ruby/CONTRIBUTING.md
    trunk/spec/ruby/core/array/at_spec.rb
    trunk/spec/ruby/core/array/intersection_spec.rb
    trunk/spec/ruby/core/array/max_spec.rb
    trunk/spec/ruby/core/array/min_spec.rb
    trunk/spec/ruby/core/array/permutation_spec.rb
    trunk/spec/ruby/core/array/pop_spec.rb
    trunk/spec/ruby/core/array/shift_spec.rb
    trunk/spec/ruby/core/bignum/bignum_spec.rb
    trunk/spec/ruby/core/dir/glob_spec.rb
    trunk/spec/ruby/core/encoding/converter/primitive_convert_spec.rb
    trunk/spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb
    trunk/spec/ruby/core/encoding/converter/putback_spec.rb
    trunk/spec/ruby/core/encoding/invalid_byte_sequence_error/source_encoding_name_spec.rb
    trunk/spec/ruby/core/encoding/invalid_byte_sequence_error/source_encoding_spec.rb
    trunk/spec/ruby/core/encoding/undefined_conversion_error/source_encoding_name_spec.rb
    trunk/spec/ruby/core/encoding/undefined_conversion_error/source_encoding_spec.rb
    trunk/spec/ruby/core/enumerable/any_spec.rb
    trunk/spec/ruby/core/enumerable/cycle_spec.rb
    trunk/spec/ruby/core/enumerable/drop_spec.rb
    trunk/spec/ruby/core/enumerable/uniq_spec.rb
    trunk/spec/ruby/core/enumerator/lazy/force_spec.rb
    trunk/spec/ruby/core/file/readlink_spec.rb
    trunk/spec/ruby/core/file/shared/fnmatch.rb
    trunk/spec/ruby/core/fixnum/fixnum_spec.rb
    trunk/spec/ruby/core/float/ceil_spec.rb
    trunk/spec/ruby/core/float/floor_spec.rb
    trunk/spec/ruby/core/float/round_spec.rb
    trunk/spec/ruby/core/float/truncate_spec.rb
    trunk/spec/ruby/core/hash/delete_spec.rb
    trunk/spec/ruby/core/hash/transform_values_spec.rb
    trunk/spec/ruby/core/integer/ceil_spec.rb
    trunk/spec/ruby/core/integer/floor_spec.rb
    trunk/spec/ruby/core/integer/integer_spec.rb
    trunk/spec/ruby/core/integer/round_spec.rb
    trunk/spec/ruby/core/integer/truncate_spec.rb
    trunk/spec/ruby/core/io/advise_spec.rb
    trunk/spec/ruby/core/io/fixtures/classes.rb
    trunk/spec/ruby/core/io/gets_spec.rb
    trunk/spec/ruby/core/io/readline_spec.rb
    trunk/spec/ruby/core/io/shared/each.rb
    trunk/spec/ruby/core/io/shared/readlines.rb
    trunk/spec/ruby/core/kernel/equal_value_spec.rb
    trunk/spec/ruby/core/main/fixtures/classes.rb
    trunk/spec/ruby/core/mutex/lock_spec.rb
    trunk/spec/ruby/core/numeric/coerce_spec.rb
    trunk/spec/ruby/core/process/wait2_spec.rb
    trunk/spec/ruby/core/random/bytes_spec.rb
    trunk/spec/ruby/core/string/capitalize_spec.rb
    trunk/spec/ruby/core/string/casecmp_spec.rb
    trunk/spec/ruby/core/string/downcase_spec.rb
    trunk/spec/ruby/core/string/lines_spec.rb
    trunk/spec/ruby/core/string/new_spec.rb
    trunk/spec/ruby/core/string/shared/chars.rb
    trunk/spec/ruby/core/string/shared/codepoints.rb
    trunk/spec/ruby/core/string/shared/each_line.rb
    trunk/spec/ruby/core/string/shared/to_sym.rb
    trunk/spec/ruby/core/string/swapcase_spec.rb
    trunk/spec/ruby/core/string/upcase_spec.rb
    trunk/spec/ruby/core/struct/initialize_spec.rb
    trunk/spec/ruby/core/symbol/capitalize_spec.rb
    trunk/spec/ruby/core/symbol/casecmp_spec.rb
    trunk/spec/ruby/core/symbol/downcase_spec.rb
    trunk/spec/ruby/core/symbol/swapcase_spec.rb
    trunk/spec/ruby/core/symbol/upcase_spec.rb
    trunk/spec/ruby/core/thread/element_set_spec.rb
    trunk/spec/ruby/core/thread/fixtures/classes.rb
    trunk/spec/ruby/core/thread/join_spec.rb
    trunk/spec/ruby/core/thread/key_spec.rb
    trunk/spec/ruby/core/thread/raise_spec.rb
    trunk/spec/ruby/core/thread/shared/exit.rb
    trunk/spec/ruby/core/thread/value_spec.rb
    trunk/spec/ruby/core/time/shared/now.rb
    trunk/spec/ruby/core/time/shared/time_params.rb
    trunk/spec/ruby/language/README
    trunk/spec/ruby/language/block_spec.rb
    trunk/spec/ruby/language/break_spec.rb
    trunk/spec/ruby/language/case_spec.rb
    trunk/spec/ruby/language/class_spec.rb
    trunk/spec/ruby/language/constants_spec.rb
    trunk/spec/ruby/language/defined_spec.rb
    trunk/spec/ruby/language/ensure_spec.rb
    trunk/spec/ruby/language/fixtures/super.rb
    trunk/spec/ruby/language/if_spec.rb
    trunk/spec/ruby/language/method_spec.rb
    trunk/spec/ruby/language/optional_assignments_spec.rb
    trunk/spec/ruby/language/predefined_spec.rb
    trunk/spec/ruby/language/regexp/character_classes_spec.rb
    trunk/spec/ruby/language/regexp/modifiers_spec.rb
    trunk/spec/ruby/language/rescue_spec.rb
    trunk/spec/ruby/language/return_spec.rb
    trunk/spec/ruby/language/super_spec.rb
    trunk/spec/ruby/language/symbol_spec.rb
    trunk/spec/ruby/language/throw_spec.rb
    trunk/spec/ruby/library/bigdecimal/sign_spec.rb
    trunk/spec/ruby/library/cgi/cookie/parse_spec.rb
    trunk/spec/ruby/library/cgi/shared/http_header.rb
    trunk/spec/ruby/library/csv/parse_spec.rb
    trunk/spec/ruby/library/csv/readlines_spec.rb
    trunk/spec/ruby/library/date/minus_month_spec.rb
    trunk/spec/ruby/library/date/minus_spec.rb
    trunk/spec/ruby/library/date/next_day_spec.rb
    trunk/spec/ruby/library/date/next_month_spec.rb
    trunk/spec/ruby/library/date/prev_day_spec.rb
    trunk/spec/ruby/library/date/prev_month_spec.rb
    trunk/spec/ruby/library/date/today_spec.rb
    trunk/spec/ruby/library/date/wday_spec.rb
    trunk/spec/ruby/library/datetime/new_spec.rb
    trunk/spec/ruby/library/datetime/now_spec.rb
    trunk/spec/ruby/library/datetime/to_date_spec.rb
    trunk/spec/ruby/library/datetime/to_datetime_spec.rb
    trunk/spec/ruby/library/datetime/to_s_spec.rb
    trunk/spec/ruby/library/datetime/to_time_spec.rb
    trunk/spec/ruby/library/etc/getlogin_spec.rb
    trunk/spec/ruby/library/fiber/resume_spec.rb
    trunk/spec/ruby/library/fiber/transfer_spec.rb
    trunk/spec/ruby/library/getoptlong/terminate_spec.rb
    trunk/spec/ruby/library/ipaddr/operator_spec.rb
    trunk/spec/ruby/library/logger/logger/new_spec.rb
    trunk/spec/ruby/library/matrix/diagonal_spec.rb
    trunk/spec/ruby/library/matrix/hermitian_spec.rb
    trunk/spec/ruby/library/matrix/normal_spec.rb
    trunk/spec/ruby/library/matrix/orthogonal_spec.rb
    trunk/spec/ruby/library/matrix/permutation_spec.rb
    trunk/spec/ruby/library/matrix/symmetric_spec.rb
    trunk/spec/ruby/library/matrix/unitary_spec.rb
    trunk/spec/ruby/library/net/ftp/fixtures/server.rb
    trunk/spec/ruby/library/net/ftp/status_spec.rb
    trunk/spec/ruby/library/net/http/http/fixtures/http_server.rb
    trunk/spec/ruby/library/net/http/http/post_spec.rb
    trunk/spec/ruby/library/net/http/http/request_types_spec.rb
    trunk/spec/ruby/library/net/http/httpheader/content_length_spec.rb
    trunk/spec/ruby/library/pathname/relative_path_from_spec.rb
    trunk/spec/ruby/library/rexml/element/add_attributes_spec.rb
    trunk/spec/ruby/library/rexml/element/add_text_spec.rb
    trunk/spec/ruby/library/securerandom/base64_spec.rb
    trunk/spec/ruby/library/securerandom/hex_spec.rb
    trunk/spec/ruby/library/set/shared/difference.rb
    trunk/spec/ruby/library/set/sortedset/shared/difference.rb
    trunk/spec/ruby/library/shellwords/shellwords_spec.rb
    trunk/spec/ruby/library/socket/tcpserver/accept_spec.rb
    trunk/spec/ruby/library/socket/tcpserver/new_spec.rb
    trunk/spec/ruby/library/socket/unixserver/accept_spec.rb
    trunk/spec/ruby/library/stringio/each_line_spec.rb
    trunk/spec/ruby/library/stringio/each_spec.rb
    trunk/spec/ruby/library/stringio/getc_spec.rb
    trunk/spec/ruby/library/stringio/getch_spec.rb
    trunk/spec/ruby/library/stringio/gets_spec.rb
    trunk/spec/ruby/library/stringio/lines_spec.rb
    trunk/spec/ruby/library/stringio/readline_spec.rb
    trunk/spec/ruby/library/stringio/readlines_spec.rb
    trunk/spec/ruby/library/stringio/shared/each.rb
    trunk/spec/ruby/library/win32ole/win32ole_method/new_spec.rb
    trunk/spec/ruby/library/yaml/shared/each_document.rb
    trunk/spec/ruby/library/yaml/to_yaml_spec.rb
    trunk/spec/ruby/optional/capi/encoding_spec.rb
    trunk/spec/ruby/optional/capi/ext/kernel_spec.c
    trunk/spec/ruby/optional/capi/ext/rubyspec.h
    trunk/spec/ruby/optional/capi/ext/string_spec.c
    trunk/spec/ruby/optional/capi/kernel_spec.rb
    trunk/spec/ruby/optional/capi/object_spec.rb
    trunk/spec/ruby/optional/capi/proc_spec.rb
    trunk/spec/ruby/optional/capi/spec_helper.rb
    trunk/spec/ruby/optional/capi/string_spec.rb
    trunk/spec/ruby/optional/capi/thread_spec.rb
    trunk/spec/ruby/shared/fiber/resume.rb
    trunk/spec/ruby/shared/rational/minus.rb
    trunk/spec/ruby/shared/rational/plus.rb
    trunk/spec/ruby/shared/rational/round.rb
    trunk/spec/ruby/spec_helper.rb
Index: spec/ruby/core/time/shared/now.rb
===================================================================
--- spec/ruby/core/time/shared/now.rb	(revision 60524)
+++ spec/ruby/core/time/shared/now.rb	(revision 60525)
@@ -5,4 +5,16 @@ describe :time_now, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/time/shared/now.rb#L5
     TimeSpecs::SubTime.send(@method).should be_an_instance_of(TimeSpecs::SubTime)
     TimeSpecs::MethodHolder.send(@method).should be_an_instance_of(Time)
   end
+
+  it "sets the current time" do
+    now = TimeSpecs::MethodHolder.send(@method)
+    now.to_f.should be_close(Process.clock_gettime(Process::CLOCK_REALTIME), 10.0)
+  end
+
+  it "uses the local timezone" do
+    with_timezone("PDT", -8) do
+      now = TimeSpecs::MethodHolder.send(@method)
+      now.utc_offset.should == (-8 * 60 * 60)
+    end
+  end
 end
Index: spec/ruby/core/numeric/coerce_spec.rb
===================================================================
--- spec/ruby/core/numeric/coerce_spec.rb	(revision 60524)
+++ spec/ruby/core/numeric/coerce_spec.rb	(revision 60525)
@@ -17,7 +17,7 @@ describe "Numeric#coerce" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/numeric/coerce_spec.rb#L17
   # I (emp) think that this behavior is actually a bug in MRI. It's here as documentation
   # of the behavior until we find out if it's a bug.
   quarantine! do
-    it "considers the presense of a metaclass when checking the class of the objects" do
+    it "considers the presence of a metaclass when checking the class of the objects" do
       a = NumericSpecs::Subclass.new
       b = NumericSpecs::Subclass.new
 
Index: spec/ruby/optional/capi/ext/string_spec.c
===================================================================
--- spec/ruby/optional/capi/ext/string_spec.c	(revision 60524)
+++ spec/ruby/optional/capi/ext/string_spec.c	(revision 60525)
@@ -181,6 +181,10 @@ VALUE string_spec_rb_str_length(VALUE se https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/string_spec.c#L181
 VALUE string_spec_rb_str_new(VALUE self, VALUE str, VALUE len) {
   return rb_str_new(RSTRING_PTR(str), FIX2INT(len));
 }
+
+VALUE string_spec_rb_str_new_offset(VALUE self, VALUE str, VALUE offset, VALUE len) {
+  return rb_str_new(RSTRING_PTR(str) + FIX2INT(offset), FIX2INT(len));
+}
 #endif
 
 #ifdef HAVE_RB_STR_NEW2
@@ -370,6 +374,13 @@ VALUE string_spec_StringValue(VALUE self https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/string_spec.c#L374
 }
 #endif
 
+#ifdef HAVE_SAFE_STRING_VALUE
+static VALUE string_spec_SafeStringValue(VALUE self, VALUE str) {
+  SafeStringValue(str);
+  return str;
+}
+#endif
+
 #ifdef HAVE_RB_STR_HASH
 static VALUE string_spec_rb_str_hash(VALUE self, VALUE str) {
   st_index_t val = rb_str_hash(str);
@@ -529,6 +540,7 @@ void Init_string_spec(void) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/string_spec.c#L540
 
 #ifdef HAVE_RB_STR_NEW
   rb_define_method(cls, "rb_str_new", string_spec_rb_str_new, 2);
+  rb_define_method(cls, "rb_str_new_offset", string_spec_rb_str_new_offset, 3);
 #endif
 
 #ifdef HAVE_RB_STR_NEW2
@@ -639,6 +651,10 @@ void Init_string_spec(void) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/string_spec.c#L651
   rb_define_method(cls, "StringValue", string_spec_StringValue, 1);
 #endif
 
+#ifdef HAVE_SAFE_STRING_VALUE
+  rb_define_method(cls, "SafeStringValue", string_spec_SafeStringValue, 1);
+#endif
+
 #ifdef HAVE_RB_STR_HASH
   rb_define_method(cls, "rb_str_hash", string_spec_rb_str_hash, 1);
 #endif
Index: spec/ruby/optional/capi/object_spec.rb
===================================================================
--- spec/ruby/optional/capi/object_spec.rb	(revision 60524)
+++ spec/ruby/optional/capi/object_spec.rb	(revision 60525)
@@ -420,6 +420,13 @@ describe "CApiObject" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/object_spec.rb#L420
       @o.rb_class_of(0.1).should == Float
       @o.rb_class_of(ObjectTest.new).should == ObjectTest
     end
+
+    it "returns the singleton class if it exists" do
+      o = ObjectTest.new
+      @o.rb_class_of(o).should equal ObjectTest
+      s = o.singleton_class
+      @o.rb_class_of(o).should equal s
+    end
   end
 
   describe "rb_obj_classname" do
Index: spec/ruby/optional/capi/kernel_spec.rb
===================================================================
--- spec/ruby/optional/capi/kernel_spec.rb	(revision 60524)
+++ spec/ruby/optional/capi/kernel_spec.rb	(revision 60525)
@@ -198,6 +198,16 @@ describe "C-API Kernel function" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/kernel_spec.rb#L198
         @s.rb_yield_indirected(1) { break 73 }.should == 73
       end
     end
+
+    it "rb_yield to block passed to enumerator" do
+      enum_class = Class.new do
+        include Enumerable
+      end
+      @s.rb_yield_define_each(enum_class)
+      res = enum_class.new.collect { |i| i * 2}
+      res.should == [0, 2, 4, 6]
+    end
+
   end
 
   describe "rb_yield_values" do
Index: spec/ruby/.travis.yml
===================================================================
--- spec/ruby/.travis.yml	(revision 60524)
+++ spec/ruby/.travis.yml	(revision 60525)
@@ -3,21 +3,23 @@ language: ruby https://github.com/ruby/ruby/blob/trunk/spec/ruby/.travis.yml#L3
 install:
   - git clone https://github.com/ruby/mspec.git ../mspec
 script:
-  - if [ -n "$RUBOCOP" ]; then gem install rubocop -v 0.49.1 && rubocop; fi
+  - if [ -n "$RUBOCOP" ]; then gem install rubocop -v 0.51.0 && rubocop; fi
   - ../mspec/bin/mspec $MSPEC_OPTS
 matrix:
   include:
     - os: osx
-      rvm: 2.4.0
+      osx_image: xcode9
+      rvm: 2.4.2
+      env: CHECK_LEAKS=true
     - os: linux
-      rvm: 2.4.1
+      rvm: 2.4.2
       env: MSPEC_OPTS="-R2 -ff"
     - os: linux
-      rvm: 2.2.7
+      rvm: 2.2.8
     - os: linux
-      rvm: 2.3.4
+      rvm: 2.3.5
     - os: linux
-      rvm: 2.4.1
+      rvm: 2.4.2
       env: CHECK_LEAKS=true RUBOCOP=true
     - os: linux
       rvm: ruby-head
Index: spec/ruby/core/time/shared/time_params.rb
===================================================================
--- spec/ruby/core/time/shared/time_params.rb	(revision 60524)
+++ spec/ruby/core/time/shared/time_params.rb	(revision 60525)
@@ -116,10 +116,8 @@ describe :time_params, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/time/shared/time_params.rb#L116
   end
 
   it "interprets all numerals as base 10" do
-    Time.send(@method, "2000", "08", "08", "08", "08", "08").should ==
-      Time.send(@method, 2000, 8, 8, 8, 8, 8)
-    Time.send(@method, "2000", "09", "09", "09", "09", "09").should ==
-      Time.send(@method, 2000, 9, 9, 9, 9, 9)
+    Time.send(@method, "2000", "08", "08", "08", "08", "08").should == Time.send(@method, 2000, 8, 8, 8, 8, 8)
+    Time.send(@method, "2000", "09", "09", "09", "09", "09").should == Time.send(@method, 2000, 9, 9, 9, 9, 9)
   end
 
   it "handles fractional seconds as a Float" do
Index: spec/ruby/core/numeric/finite_spec.rb
===================================================================
--- spec/ruby/core/numeric/finite_spec.rb	(nonexistent)
+++ spec/ruby/core/numeric/finite_spec.rb	(revision 60525)
@@ -0,0 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/numeric/finite_spec.rb#L1
+require File.expand_path('../../../spec_helper', __FILE__)
+
+ruby_version_is "2.4" do
+  describe "Numeric#finite?" do
+    it "returns true by default" do
+      o = mock_numeric("finite")
+      o.finite?.should be_true
+    end
+  end
+end
Index: spec/ruby/core/thread/raise_spec.rb
===================================================================
--- spec/ruby/core/thread/raise_spec.rb	(revision 60524)
+++ spec/ruby/core/thread/raise_spec.rb	(revision 60525)
@@ -51,6 +51,7 @@ describe "Thread#raise on a sleeping thr https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/raise_spec.rb#L51
 
   it "is captured and raised by Thread#value" do
     t = Thread.new do
+      Thread.current.report_on_exception = false
       sleep
     end
 
@@ -62,6 +63,7 @@ describe "Thread#raise on a sleeping thr https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/raise_spec.rb#L63
 
   it "raises a RuntimeError when called with no arguments inside rescue" do
     t = Thread.new do
+      Thread.current.report_on_exception = false
       begin
         1/0
       rescue ZeroDivisionError
@@ -113,6 +115,7 @@ describe "Thread#raise on a running thre https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/raise_spec.rb#L115
 
   it "can go unhandled" do
     t = Thread.new do
+      Thread.current.report_on_exception = false
       loop { Thread.pass }
     end
 
@@ -123,6 +126,7 @@ describe "Thread#raise on a running thre https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/raise_spec.rb#L126
   it "raises the given argument even when there is an active exception" do
     raised = false
     t = Thread.new do
+      Thread.current.report_on_exception = false
       begin
         1/0
       rescue ZeroDivisionError
@@ -142,6 +146,7 @@ describe "Thread#raise on a running thre https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/raise_spec.rb#L146
   it "raises a RuntimeError when called with no arguments inside rescue" do
     raised = false
     t = Thread.new do
+      Thread.current.report_on_exception = false
       begin
         1/0
       rescue ZeroDivisionError
@@ -164,6 +169,7 @@ describe "Thread#raise on same thread" d https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/thread/raise_spec.rb#L169
 
   it "raises a RuntimeError when called with no arguments inside rescue" do
     t = Thread.new do
+      Thread.current.report_on_exception = false
       begin
         1/0
       rescue ZeroDivisionError
Index: spec/ruby/language/symbol_spec.rb
===================================================================
--- spec/ruby/language/symbol_spec.rb	(revision 60524)
+++ spec/ruby/language/symbol_spec.rb	(revision 60525)
@@ -36,6 +36,11 @@ describe "A Symbol literal" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/symbol_spec.rb#L36
     }
   end
 
+  it 'inherits the encoding of the magic comment and can have a binary encoding' do
+    ruby_exe(fixture(__FILE__, "binary_symbol.rb"))
+      .should == "[105, 108, 95, 195, 169, 116, 97, 105, 116]\nASCII-8BIT\n"
+  end
+
   it "may contain '::' in the string" do
     :'Some::Class'.should be_kind_of(Symbol)
   end
@@ -90,4 +95,12 @@ describe "A Symbol literal" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/symbol_spec.rb#L95
   it "can be created from list syntax %I{a b c} with interpolation" do
     %I{a b #{"c"}}.should == [:a, :b, :c]
   end
+
+  it "with invalid bytes raises an EncodingError at parse time" do
+    ScratchPad.record []
+    -> {
+      eval 'ScratchPad << 1; :"\xC3"'
+    }.should raise_error(EncodingError, /invalid/)
+    ScratchPad.recorded.should == []
+  end
 end
Index: spec/ruby/language/class_spec.rb
===================================================================
--- spec/ruby/language/class_spec.rb	(revision 60524)
+++ spec/ruby/language/class_spec.rb	(revision 60525)
@@ -88,19 +88,17 @@ describe "A class definition" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/class_spec.rb#L88
   end
 
   # [Bug #12367] [ruby-core:75446]
-  ruby_version_is "2.4" do # Until backported
-    it "raises an error when reopening a class with Object as superclass" do
-      module ClassSpecs
-        class SuperclassReopenedObject < A
-        end
-        SuperclassReopenedObject.superclass.should == A
-
-        lambda {
-          class SuperclassReopenedObject < Object
-          end
-        }.should raise_error(TypeError, /superclass mismatch/)
-        SuperclassReopenedObject.superclass.should == A
+  it "raises an error when reopening a class with Object as superclass" do
+    module ClassSpecs
+      class SuperclassReopenedObject < A
       end
+      SuperclassReopenedObject.superclass.should == A
+
+      lambda {
+        class SuperclassReopenedObject < Object
+        end
+      }.should raise_error(TypeError, /superclass mismatch/)
+      SuperclassReopenedObject.superclass.should == A
     end
   end
 
Index: spec/ruby/language/constants_spec.rb
===================================================================
--- spec/ruby/language/constants_spec.rb	(revision 60524)
+++ spec/ruby/language/constants_spec.rb	(revision 60525)
@@ -353,16 +353,27 @@ describe "Constant resolution within met https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/constants_spec.rb#L353
   end
 
   describe "with ||=" do
-    it "assignes constant if previously undefined" do
+    it "assigns a scoped constant if previously undefined" do
       ConstantSpecs.should_not have_constant(:OpAssignUndefined)
-      # Literally opening the module is required to avoid content
-      # re-assignment error
       module ConstantSpecs
         OpAssignUndefined ||= 42
       end
       ConstantSpecs::OpAssignUndefined.should == 42
+      ConstantSpecs::OpAssignUndefinedOutside ||= 42
+      ConstantSpecs::OpAssignUndefinedOutside.should == 42
       ConstantSpecs.send(:remove_const, :OpAssignUndefined)
+      ConstantSpecs.send(:remove_const, :OpAssignUndefinedOutside)
     end
+
+    it "assigns a global constant if previously undefined" do
+      OpAssignGlobalUndefined ||= 42
+      ::OpAssignGlobalUndefinedExplicitScope ||= 42
+      OpAssignGlobalUndefined.should == 42
+      ::OpAssignGlobalUndefinedExplicitScope.should == 42
+      Object.send :remove_const, :OpAssignGlobalUndefined
+      Object.send :remove_const, :OpAssignGlobalUndefinedExplicitScope
+    end
+
   end
 end
 
Index: spec/ruby/language/method_spec.rb
===================================================================
--- spec/ruby/language/method_spec.rb	(revision 60524)
+++ spec/ruby/language/method_spec.rb	(revision 60525)
@@ -1178,7 +1178,7 @@ describe "A method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L1178
     end
 
     evaluate <<-ruby do
-        def m a, b=1, *c, d, e:, f: 2, g:, **k, &l
+        def m(a, b=1, *c, d, e:, f: 2, g:, **k, &l)
           [a, b, c, d, e, f, g, k, l]
         end
       ruby
@@ -1188,13 +1188,19 @@ describe "A method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/method_spec.rb#L1188
     end
 
     evaluate <<-ruby do
-        def m (a, b = nil, c = nil, d, e: nil, **f)
+        def m(a, b = nil, c = nil, d, e: nil, **f)
           [a, b, c, d, e, f]
         end
     ruby
 
       result = m(1, 2)
       result.should == [1, nil, nil, 2, nil, {}]
+
+      result = m(1, 2, {foo: :bar})
+      result.should == [1, nil, nil, 2, nil, {foo: :bar}]
+
+      result = m(1, {foo: :bar})
+      result.should == [1, nil, nil, {foo: :bar}, nil, {}]
     end
   end
 end
Index: spec/ruby/language/rescue_spec.rb
===================================================================
--- spec/ruby/language/rescue_spec.rb	(revision 60524)
+++ spec/ruby/language/rescue_spec.rb	(revision 60525)
@@ -290,4 +290,11 @@ describe "The rescue keyword" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/rescue_spec.rb#L290
       :expected
     end.should == :expected
   end
+
+  ruby_version_is "2.4" do
+    it "allows 'rescue' in method arguments" do
+      two = eval '1.+ (raise("Error") rescue 1)'
+      two.should == 2
+    end
+  end
 end
Index: spec/ruby/language/optional_assignments_spec.rb
===================================================================
--- spec/ruby/language/optional_assignments_spec.rb	(revision 60524)
+++ spec/ruby/language/optional_assignments_spec.rb	(revision 60525)
@@ -207,7 +207,7 @@ describe 'Optional variable assignments' https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/optional_assignments_spec.rb#L207
       Object::A.should == 10
     end
 
-    it 'with &&= assignments will fail with non-existant constants' do
+    it 'with &&= assignments will fail with non-existent constants' do
       lambda { Object::A &&= 10 }.should raise_error(NameError)
     end
 
@@ -219,7 +219,7 @@ describe 'Optional variable assignments' https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/optional_assignments_spec.rb#L219
       Object::A.should == 30
     end
 
-    it 'with operator assignments will fail with non-existant constants' do
+    it 'with operator assignments will fail with non-existent constants' do
       lambda { Object::A += 10 }.should raise_error(NameError)
     end
   end
Index: spec/ruby/language/ensure_spec.rb
===================================================================
--- spec/ruby/language/ensure_spec.rb	(revision 60524)
+++ spec/ruby/language/ensure_spec.rb	(revision 60525)
@@ -11,7 +11,7 @@ describe "An ensure block inside a begin https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/ensure_spec.rb#L11
       lambda {
         begin
           ScratchPad << :begin
-          raise "An exception occured!"
+          raise "An exception occurred!"
         ensure
           ScratchPad << :ensure
         end
@@ -25,7 +25,7 @@ describe "An ensure block inside a begin https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/ensure_spec.rb#L25
     begin
       begin
         ScratchPad << :begin
-        raise "An exception occured!"
+        raise "An exception occurred!"
       rescue
         ScratchPad << :rescue
       ensure
Index: spec/ruby/language/throw_spec.rb
===================================================================
--- spec/ruby/language/throw_spec.rb	(revision 60524)
+++ spec/ruby/language/throw_spec.rb	(revision 60525)
@@ -68,13 +68,14 @@ describe "The throw keyword" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/throw_spec.rb#L68
     lambda { catch(:different) { throw :test, 5 } }.should raise_error(ArgumentError)
   end
 
-  it "raises an ArgumentError if used to exit a thread" do
-    lambda {
-      catch(:what) do
-        Thread.new {
+  it "raises an UncaughtThrowError if used to exit a thread" do
+    catch(:what) do
+      t = Thread.new {
+        -> {
           throw :what
-        }.join
-      end
-    }.should raise_error(ArgumentError)
+        }.should raise_error(UncaughtThrowError)
+      }
+      t.join
+    end
   end
 end
Index: spec/ruby/language/predefined_spec.rb
===================================================================
--- spec/ruby/language/predefined_spec.rb	(revision 60524)
+++ spec/ruby/language/predefined_spec.rb	(revision 60525)
@@ -879,6 +879,25 @@ describe "Global variable $-d" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/predefined_spec.rb#L879
   end
 end
 
+describe "Global variable $VERBOSE" do
+  it "converts truthy values to true" do
+    [true, 1, 0, [], ""].each do |true_value|
+      $VERBOSE = true_value
+      $VERBOSE.should be_true
+    end
+  end
+
+  it "allows false" do
+    $VERBOSE = false
+    $VERBOSE.should be_false
+  end
+
+  it "allows nil without coercing to false" do
+    $VERBOSE = nil
+    $VERBOSE.should be_nil
+  end
+end
+
 describe :verbose_global_alias, shared: true do
   before :each do
     @verbose = $VERBOSE
Index: spec/ruby/language/case_spec.rb
===================================================================
--- spec/ruby/language/case_spec.rb	(revision 60524)
+++ spec/ruby/language/case_spec.rb	(revision 60525)
@@ -379,4 +379,11 @@ describe "The 'case'-construct with no t https://github.com/ruby/ruby/blob/trunk/spec/ruby/language/case_spec.rb#L379
       :called
     end.should == :called
   end
+
+  it "accepts complex expressions within ()" do
+    case 'a'
+    when (raise if 2+2 == 3; /a/)
+      :called
+    end.should == :called
+  end
 end
Index: spec/ruby/language/regexp/modifiers_spec.rb
===================================================================
--- spec/ruby/language/regexp/modifiers_sp (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]