mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Drop support for ruby 2.4 from ruby/spec
This commit is contained in:
		
							parent
							
								
									3a2073e61b
								
							
						
					
					
						commit
						826f44834f
					
				
				
				Notes:
				
					git
				
				2020-04-01 15:36:48 +09:00 
				
			
			
			
		
		
					 145 changed files with 2343 additions and 3347 deletions
				
			
		
							
								
								
									
										10
									
								
								.travis.yml
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								.travis.yml
									
										
									
									
									
								
							|  | @ -360,17 +360,17 @@ env: | ||||||
|         -Wunused-variable' |         -Wunused-variable' | ||||||
|       - LDFLAGS=-Wno-unused-command-line-argument |       - LDFLAGS=-Wno-unused-command-line-argument | ||||||
| 
 | 
 | ||||||
|   - &rubyspec24 |   - &rubyspec25 | ||||||
|     name: Check ruby/spec version guards on Ruby 2.4 |     name: Check ruby/spec version guards on Ruby 2.5 | ||||||
|     language: ruby |     language: ruby | ||||||
|     rvm: 2.4.9 |     rvm: 2.5.7 | ||||||
|     before_install: |     before_install: | ||||||
|     install: |     install: | ||||||
|     before_script: chmod -R u+w spec/ruby |     before_script: chmod -R u+w spec/ruby | ||||||
|     # -j randomly hangs. |     # -j randomly hangs. | ||||||
|     script: ruby -C spec/ruby ../mspec/bin/mspec . |     script: ruby -C spec/ruby ../mspec/bin/mspec . | ||||||
|     after_failure: |     after_failure: | ||||||
|       - echo "ruby/spec failed on Ruby 2.4. This is likely because of a missing ruby_version_is guard, please add it. See spec/README.md." |       - echo "ruby/spec failed on Ruby 2.5. This is likely because of a missing ruby_version_is guard, please add it. See spec/README.md." | ||||||
| 
 | 
 | ||||||
|   - &rubyspec27 |   - &rubyspec27 | ||||||
|     name: Check ruby/spec version guards on Ruby 2.7 |     name: Check ruby/spec version guards on Ruby 2.7 | ||||||
|  | @ -435,7 +435,7 @@ matrix: | ||||||
|     - <<: *pedanticism |     - <<: *pedanticism | ||||||
|     - <<: *assertions |     - <<: *assertions | ||||||
|     - <<: *baseruby |     - <<: *baseruby | ||||||
|     - <<: *rubyspec24 |     - <<: *rubyspec25 | ||||||
|     - <<: *rubyspec27 |     - <<: *rubyspec27 | ||||||
|     - <<: *dependency |     - <<: *dependency | ||||||
|     # Build every commit (Allowed Failures): |     # Build every commit (Allowed Failures): | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ specs in a manner compatible with multiple Ruby implementations. | ||||||
| 
 | 
 | ||||||
| ## Requirements | ## Requirements | ||||||
| 
 | 
 | ||||||
| MSpec requires Ruby 2.4 or more recent. | MSpec requires Ruby 2.5 or more recent. | ||||||
| 
 | 
 | ||||||
| ## Bundler | ## Bundler | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -39,8 +39,8 @@ class MSpecScript | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def initialize |   def initialize | ||||||
|     ruby_version_is ""..."2.4" do |     ruby_version_is ""..."2.5" do | ||||||
|       abort "MSpec needs Ruby 2.4 or more recent" |       abort "MSpec needs Ruby 2.5 or more recent" | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     config[:formatter] = nil |     config[:formatter] = nil | ||||||
|  |  | ||||||
|  | @ -1,20 +1,6 @@ | ||||||
| require 'mspec/guards/version' | require 'mspec/guards/version' | ||||||
| 
 | 
 | ||||||
| if RUBY_ENGINE == "ruby" | if RUBY_ENGINE == "ruby" | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     # Kernel#warn does not delegate to Warning.warn in 2.4 |  | ||||||
|     module Kernel |  | ||||||
|       remove_method :warn |  | ||||||
|       def warn(*messages) |  | ||||||
|         return if $VERBOSE == nil or messages.empty? |  | ||||||
|         msg = messages.join("\n") |  | ||||||
|         msg += "\n" unless msg.end_with?("\n") |  | ||||||
|         Warning.warn(msg) |  | ||||||
|       end |  | ||||||
|       private :warn |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def Warning.warn(message) |   def Warning.warn(message) | ||||||
|     # Suppress any warning inside the method to prevent recursion |     # Suppress any warning inside the method to prevent recursion | ||||||
|     verbose = $VERBOSE |     verbose = $VERBOSE | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| inherit_from: .rubocop_todo.yml | inherit_from: .rubocop_todo.yml | ||||||
| 
 | 
 | ||||||
| AllCops: | AllCops: | ||||||
|   TargetRubyVersion: 2.4 |   TargetRubyVersion: 2.5 | ||||||
|   DisplayCopNames: true |   DisplayCopNames: true | ||||||
|   Exclude: |   Exclude: | ||||||
|     - command_line/fixtures/bad_syntax.rb |     - command_line/fixtures/bad_syntax.rb | ||||||
|  |  | ||||||
|  | @ -133,12 +133,12 @@ Here is a list of the most commonly-used guards: | ||||||
| #### Version guards | #### Version guards | ||||||
| 
 | 
 | ||||||
| ```ruby | ```ruby | ||||||
| ruby_version_is ""..."2.4" do | ruby_version_is ""..."2.6 do | ||||||
|   # Specs for RUBY_VERSION < 2.4 |   # Specs for RUBY_VERSION < 2.6 | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.4" do | ruby_version_is "2.6 do | ||||||
|   # Specs for RUBY_VERSION >= 2.4 |   # Specs for RUBY_VERSION >= 2.6 | ||||||
| end | end | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | @ -185,11 +185,11 @@ end | ||||||
| #### Combining guards | #### Combining guards | ||||||
| 
 | 
 | ||||||
| ```ruby | ```ruby | ||||||
| guard -> { platform_is :windows and ruby_version_is ""..."2.5" } do | guard -> { platform_is :windows and ruby_version_is ""..."2.6" } do | ||||||
|   # Windows and RUBY_VERSION < 2.5 |   # Windows and RUBY_VERSION < 2.6 | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| guard_not -> { platform_is :windows and ruby_version_is ""..."2.5" } do | guard_not -> { platform_is :windows and ruby_version_is ""..."2.6" } do | ||||||
|   # The opposite |   # The opposite | ||||||
| end | end | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | @ -27,8 +27,8 @@ ruby/spec is known to be tested in these implementations for every commit: | ||||||
| * [TruffleRuby](https://github.com/oracle/truffleruby/tree/master/spec/ruby) | * [TruffleRuby](https://github.com/oracle/truffleruby/tree/master/spec/ruby) | ||||||
| * [Opal](https://github.com/opal/opal/tree/master/spec) | * [Opal](https://github.com/opal/opal/tree/master/spec) | ||||||
| 
 | 
 | ||||||
| ruby/spec describes the behavior of Ruby 2.4 and more recent Ruby versions. | ruby/spec describes the behavior of Ruby 2.5 and more recent Ruby versions. | ||||||
| More precisely, every latest stable MRI release should [pass](https://travis-ci.org/ruby/spec) all specs of ruby/spec (2.4.x, 2.5.x, 2.6.x, 2.7.x, etc), and those are tested in TravisCI. | More precisely, every latest stable MRI release should [pass](https://travis-ci.org/ruby/spec) all specs of ruby/spec (2.5.x, 2.6.x, 2.7.x, etc), and those are tested in TravisCI. | ||||||
| 
 | 
 | ||||||
| The specs are synchronized both ways around once a month by @eregon between ruby/spec, MRI, JRuby and TruffleRuby. | The specs are synchronized both ways around once a month by @eregon between ruby/spec, MRI, JRuby and TruffleRuby. | ||||||
| Each of these repositories has a full copy of the specs under `spec/ruby` to ease editing specs. | Each of these repositories has a full copy of the specs under `spec/ruby` to ease editing specs. | ||||||
|  | @ -49,6 +49,8 @@ For older specs try these commits: | ||||||
| * Ruby 2.1.9 - [Suite](https://github.com/ruby/spec/commit/f029e65241374386077ac500add557ae65069b55) using [MSpec](https://github.com/ruby/mspec/commit/55568ea3918c6380e64db8c567d732fa5781efed) | * Ruby 2.1.9 - [Suite](https://github.com/ruby/spec/commit/f029e65241374386077ac500add557ae65069b55) using [MSpec](https://github.com/ruby/mspec/commit/55568ea3918c6380e64db8c567d732fa5781efed) | ||||||
| * Ruby 2.2.10 - [Suite](https://github.com/ruby/spec/commit/cbaa0e412270c944df0c2532fc500c920dba0e92) using [MSpec](https://github.com/ruby/mspec/commit/d84d7668449e96856c5f6bac8cb1526b6d357ce3) | * Ruby 2.2.10 - [Suite](https://github.com/ruby/spec/commit/cbaa0e412270c944df0c2532fc500c920dba0e92) using [MSpec](https://github.com/ruby/mspec/commit/d84d7668449e96856c5f6bac8cb1526b6d357ce3) | ||||||
| * Ruby 2.3.8 - [Suite](https://github.com/ruby/spec/commit/dc733114d8ae66a3368ba3a98422c50147a76ba5) using [MSpec](https://github.com/ruby/mspec/commit/4599bc195fb109f2a482a01c32a7d659518369ea) | * Ruby 2.3.8 - [Suite](https://github.com/ruby/spec/commit/dc733114d8ae66a3368ba3a98422c50147a76ba5) using [MSpec](https://github.com/ruby/mspec/commit/4599bc195fb109f2a482a01c32a7d659518369ea) | ||||||
|  | * Ruby 2.4.10 - [Suite](https://github.com/ruby/spec/commit/f03892a0a9cac6972e0aa6f83cb08bb8e9b5739c) using [MSpec](https://github.com/ruby/mspec/commit/18fd75a7b4853d79d8148f6a503f99733be91712) | ||||||
|  | * Ruby 2.5.8 - [Suite](https://github.com/ruby/spec/commit/f03892a0a9cac6972e0aa6f83cb08bb8e9b5739c) using [MSpec](https://github.com/ruby/mspec/commit/18fd75a7b4853d79d8148f6a503f99733be91712) | ||||||
| 
 | 
 | ||||||
| ### Running the specs | ### Running the specs | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,13 +11,11 @@ describe "The -l command line option" do | ||||||
|         "false\nfalse\nfalse\n" |         "false\nfalse\nfalse\n" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "chomps last line based on $/" do |   it "chomps last line based on $/" do | ||||||
|     ruby_exe('BEGIN { $/ = "ones\n" }; puts $_', options: "-W0 -n -l", escape: true, |     ruby_exe('BEGIN { $/ = "ones\n" }; puts $_', options: "-W0 -n -l", escape: true, | ||||||
|              args: " < #{@names}").should == |              args: " < #{@names}").should == | ||||||
|       "alice j\nbob field\njames grey\n" |       "alice j\nbob field\njames grey\n" | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "sets $\\ to the value of $/" do |   it "sets $\\ to the value of $/" do | ||||||
|     ruby_exe("puts $\\ == $/", options: "-W0 -n -l", escape: true, |     ruby_exe("puts $\\ == $/", options: "-W0 -n -l", escape: true, | ||||||
|  |  | ||||||
|  | @ -35,8 +35,6 @@ describe "Array#<<" do | ||||||
|   end |   end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Array#append" do | ||||||
|   describe "Array#append" do |  | ||||||
|   it_behaves_like :array_push, :append |   it_behaves_like :array_push, :append | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -109,21 +109,11 @@ describe "Array#flatten" do | ||||||
|       -> { [@obj].flatten }.should raise_error(TypeError) |       -> { [@obj].flatten }.should raise_error(TypeError) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is ""..."2.5" do |  | ||||||
|       it "calls respond_to_missing?(:to_ary, false) to try coercing" do |  | ||||||
|         def @obj.respond_to_missing?(*args) ScratchPad << args; false end |  | ||||||
|         [@obj].flatten.should == [@obj] |  | ||||||
|         ScratchPad.recorded.should == [[:to_ary, false]] |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "calls respond_to_missing?(:to_ary, true) to try coercing" do |     it "calls respond_to_missing?(:to_ary, true) to try coercing" do | ||||||
|       def @obj.respond_to_missing?(*args) ScratchPad << args; false end |       def @obj.respond_to_missing?(*args) ScratchPad << args; false end | ||||||
|       [@obj].flatten.should == [@obj] |       [@obj].flatten.should == [@obj] | ||||||
|       ScratchPad.recorded.should == [[:to_ary, true]] |       ScratchPad.recorded.should == [[:to_ary, true]] | ||||||
|     end |     end | ||||||
|     end |  | ||||||
| 
 | 
 | ||||||
|     it "does not call #to_ary if not defined when #respond_to_missing? returns false" do |     it "does not call #to_ary if not defined when #respond_to_missing? returns false" do | ||||||
|       def @obj.respond_to_missing?(name, priv) ScratchPad << name; false end |       def @obj.respond_to_missing?(name, priv) ScratchPad << name; false end | ||||||
|  |  | ||||||
|  | @ -2,8 +2,6 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/classes' | require_relative 'fixtures/classes' | ||||||
| require_relative 'shared/unshift' | require_relative 'shared/unshift' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Array#prepend" do | ||||||
|   describe "Array#prepend" do |  | ||||||
|   it_behaves_like :array_unshift, :prepend |   it_behaves_like :array_unshift, :prepend | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Binding#irb" do | ||||||
|   describe "Binding#irb" do |  | ||||||
|   it "creates an IRB session with the binding in scope" do |   it "creates an IRB session with the binding in scope" do | ||||||
|     irb_fixture = fixture __FILE__, "irb.rb" |     irb_fixture = fixture __FILE__, "irb.rb" | ||||||
|     irbrc_fixture = fixture __FILE__, "irbrc" |     irbrc_fixture = fixture __FILE__, "irbrc" | ||||||
|  | @ -14,5 +13,4 @@ ruby_version_is "2.5" do | ||||||
| 
 | 
 | ||||||
|     out[-3..-1].should == ["a ** 2", "100", "exit"] |     out[-3..-1].should == ["a ** 2", "100", "exit"] | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -7,9 +7,7 @@ describe "Data" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "is deprecated" do |   it "is deprecated" do | ||||||
|     -> { Data }.should complain(/constant ::Data is deprecated/) |     -> { Data }.should complain(/constant ::Data is deprecated/) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -3,8 +3,7 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/common' | require_relative 'fixtures/common' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Dir.children" do | ||||||
|   describe "Dir.children" do |  | ||||||
|   before :all do |   before :all do | ||||||
|     DirSpecs.create_mock_dirs |     DirSpecs.create_mock_dirs | ||||||
|   end |   end | ||||||
|  | @ -68,7 +67,6 @@ ruby_version_is "2.5" do | ||||||
|   it "raises a SystemCallError if called with a nonexistent directory" do |   it "raises a SystemCallError if called with a nonexistent directory" do | ||||||
|     -> { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError) |     -> { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.6" do | ruby_version_is "2.6" do | ||||||
|  |  | ||||||
|  | @ -1,8 +1,7 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/common' | require_relative 'fixtures/common' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Dir.each_child" do | ||||||
|   describe "Dir.each_child" do |  | ||||||
|   before :all do |   before :all do | ||||||
|     DirSpecs.create_mock_dirs |     DirSpecs.create_mock_dirs | ||||||
|   end |   end | ||||||
|  | @ -49,7 +48,6 @@ ruby_version_is "2.5" do | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.6" do | ruby_version_is "2.6" do | ||||||
|  |  | ||||||
|  | @ -291,7 +291,6 @@ describe :dir_glob, shared: true do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   context ":base option passed" do |   context ":base option passed" do | ||||||
|     before :each do |     before :each do | ||||||
|       @mock_dir = File.expand_path tmp('dir_glob_mock') |       @mock_dir = File.expand_path tmp('dir_glob_mock') | ||||||
|  | @ -361,7 +360,6 @@ describe :dir_glob, shared: true do | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| describe :dir_glob_recursive, shared: true do | describe :dir_glob_recursive, shared: true do | ||||||
|  |  | ||||||
|  | @ -26,15 +26,6 @@ describe "Enumerable#all?" do | ||||||
|     -> { {}.all?(1, 2, 3) }.should raise_error(ArgumentError) |     -> { {}.all?(1, 2, 3) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "raises an ArgumentError when any arguments provided" do |  | ||||||
|       -> { @enum.all?(Proc.new {}) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum.all?(nil) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @empty.all?(1) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum1.all?(1) {} }.should raise_error(ArgumentError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   it "does not hide exceptions out of #each" do |   it "does not hide exceptions out of #each" do | ||||||
|     -> { |     -> { | ||||||
|       EnumerableSpecs::ThrowingEach.new.all? |       EnumerableSpecs::ThrowingEach.new.all? | ||||||
|  | @ -133,7 +124,6 @@ describe "Enumerable#all?" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe 'when given a pattern argument' do |   describe 'when given a pattern argument' do | ||||||
|     it "calls `===` on the pattern the return value " do |     it "calls `===` on the pattern the return value " do | ||||||
|       pattern = EnumerableSpecs::Pattern.new { |x| x >= 0 } |       pattern = EnumerableSpecs::Pattern.new { |x| x >= 0 } | ||||||
|  | @ -197,5 +187,4 @@ describe "Enumerable#all?" do | ||||||
|       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] |       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -26,15 +26,6 @@ describe "Enumerable#any?" do | ||||||
|     -> { {}.any?(1, 2, 3) }.should raise_error(ArgumentError) |     -> { {}.any?(1, 2, 3) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "raises an ArgumentError when any arguments provided" do |  | ||||||
|       -> { @enum.any?(Proc.new {}) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum.any?(nil) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @empty.any?(1) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum1.any?(1) {} }.should raise_error(ArgumentError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   it "does not hide exceptions out of #each" do |   it "does not hide exceptions out of #each" do | ||||||
|     -> { |     -> { | ||||||
|       EnumerableSpecs::ThrowingEach.new.any? |       EnumerableSpecs::ThrowingEach.new.any? | ||||||
|  | @ -147,7 +138,6 @@ describe "Enumerable#any?" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe 'when given a pattern argument' do |   describe 'when given a pattern argument' do | ||||||
|     it "calls `===` on the pattern the return value " do |     it "calls `===` on the pattern the return value " do | ||||||
|       pattern = EnumerableSpecs::Pattern.new { |x| x == 2 } |       pattern = EnumerableSpecs::Pattern.new { |x| x == 2 } | ||||||
|  | @ -210,5 +200,4 @@ describe "Enumerable#any?" do | ||||||
|       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] |       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -20,15 +20,6 @@ describe "Enumerable#none?" do | ||||||
|     -> { {}.none?(1, 2, 3) }.should raise_error(ArgumentError) |     -> { {}.none?(1, 2, 3) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "raises an ArgumentError when any arguments provided" do |  | ||||||
|       -> { @enum.none?(Proc.new {}) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum.none?(nil) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @empty.none?(1) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum.none?(1) {} }.should raise_error(ArgumentError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   it "does not hide exceptions out of #each" do |   it "does not hide exceptions out of #each" do | ||||||
|     -> { |     -> { | ||||||
|       EnumerableSpecs::ThrowingEach.new.none? |       EnumerableSpecs::ThrowingEach.new.none? | ||||||
|  | @ -102,7 +93,6 @@ describe "Enumerable#none?" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe 'when given a pattern argument' do |   describe 'when given a pattern argument' do | ||||||
|     it "calls `===` on the pattern the return value " do |     it "calls `===` on the pattern the return value " do | ||||||
|       pattern = EnumerableSpecs::Pattern.new { |x| x == 3 } |       pattern = EnumerableSpecs::Pattern.new { |x| x == 3 } | ||||||
|  | @ -163,5 +153,4 @@ describe "Enumerable#none?" do | ||||||
|       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] |       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -20,15 +20,6 @@ describe "Enumerable#one?" do | ||||||
|     -> { {}.one?(1, 2, 3) }.should raise_error(ArgumentError) |     -> { {}.one?(1, 2, 3) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "raises an ArgumentError when any arguments provided" do |  | ||||||
|       -> { @enum.one?(Proc.new {}) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum.one?(nil) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @empty.one?(1) }.should raise_error(ArgumentError) |  | ||||||
|       -> { @enum.one?(1) {} }.should raise_error(ArgumentError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   it "does not hide exceptions out of #each" do |   it "does not hide exceptions out of #each" do | ||||||
|     -> { |     -> { | ||||||
|       EnumerableSpecs::ThrowingEach.new.one? |       EnumerableSpecs::ThrowingEach.new.one? | ||||||
|  | @ -93,7 +84,6 @@ describe "Enumerable#one?" do | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe 'when given a pattern argument' do |   describe 'when given a pattern argument' do | ||||||
|     it "calls `===` on the pattern the return value " do |     it "calls `===` on the pattern the return value " do | ||||||
|       pattern = EnumerableSpecs::Pattern.new { |x| x == 1 } |       pattern = EnumerableSpecs::Pattern.new { |x| x == 1 } | ||||||
|  | @ -165,5 +155,4 @@ describe "Enumerable#one?" do | ||||||
|       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] |       pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]] | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Exception#full_message" do | ||||||
|   describe "Exception#full_message" do |  | ||||||
|   it "returns formatted string of exception using the same format that is used to print an uncaught exceptions to stderr" do |   it "returns formatted string of exception using the same format that is used to print an uncaught exceptions to stderr" do | ||||||
|     e = RuntimeError.new("Some runtime error") |     e = RuntimeError.new("Some runtime error") | ||||||
|     e.set_backtrace(["a.rb:1", "b.rb:2"]) |     e.set_backtrace(["a.rb:1", "b.rb:2"]) | ||||||
|  | @ -90,5 +89,4 @@ ruby_version_is "2.5" do | ||||||
|       exception.full_message.should include "origin exception" |       exception.full_message.should include "origin exception" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -37,7 +37,9 @@ describe "Exception" do | ||||||
|             FloatDomainError => nil, |             FloatDomainError => nil, | ||||||
|           }, |           }, | ||||||
|           RegexpError => nil, |           RegexpError => nil, | ||||||
|           RuntimeError => nil, |           RuntimeError => { | ||||||
|  |             FrozenError => nil, | ||||||
|  |           }, | ||||||
|           SystemCallError => nil, |           SystemCallError => nil, | ||||||
|           ThreadError => nil, |           ThreadError => nil, | ||||||
|           TypeError => nil, |           TypeError => nil, | ||||||
|  | @ -47,9 +49,7 @@ describe "Exception" do | ||||||
|         SystemStackError => nil, |         SystemStackError => nil, | ||||||
|       }, |       }, | ||||||
|     } |     } | ||||||
|     ruby_version_is "2.5" do | 
 | ||||||
|       hierarchy[Exception][StandardError][RuntimeError] = {FrozenError => nil} |  | ||||||
|     end |  | ||||||
|     traverse = -> parent_class, parent_subclass_hash { |     traverse = -> parent_class, parent_subclass_hash { | ||||||
|       parent_subclass_hash.each do |child_class, child_subclass_hash| |       parent_subclass_hash.each do |child_class, child_subclass_hash| | ||||||
|         child_class.class.should == Class |         child_class.class.should == Class | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ describe "File.atime" do | ||||||
|     File.atime(@file).should be_kind_of(Time) |     File.atime(@file).should be_kind_of(Time) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   guard -> { platform_is :linux or (platform_is :windows and ruby_version_is '2.5') } do |   guard -> { platform_is :linux or platform_is :windows } do | ||||||
|     ## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed. |     ## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed. | ||||||
|     it "returns the last access time for the named file with microseconds" do |     it "returns the last access time for the named file with microseconds" do | ||||||
|       supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10) |       supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10) | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ describe "File.ctime" do | ||||||
|     File.ctime(@file).should be_kind_of(Time) |     File.ctime(@file).should be_kind_of(Time) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   guard -> { platform_is :linux or (platform_is :windows and ruby_version_is '2.5') } do |   guard -> { platform_is :linux or platform_is :windows } do | ||||||
|     it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do |     it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do | ||||||
|       supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10) |       supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10) | ||||||
|       if supports_subseconds != 0 |       if supports_subseconds != 0 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "File.lutime" do | ||||||
|   describe "File.lutime" do |  | ||||||
|   platform_is_not :windows do |   platform_is_not :windows do | ||||||
|     before :each do |     before :each do | ||||||
|       @atime = Time.utc(2000) |       @atime = Time.utc(2000) | ||||||
|  | @ -36,5 +35,4 @@ ruby_version_is "2.5" do | ||||||
|       file.mtime.should == original.mtime |       file.mtime.should == original.mtime | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ describe "File.mtime" do | ||||||
|     File.mtime(@filename).should be_close(@mtime, TIME_TOLERANCE) |     File.mtime(@filename).should be_close(@mtime, TIME_TOLERANCE) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   guard -> { platform_is :linux or (platform_is :windows and ruby_version_is '2.5') } do |   guard -> { platform_is :linux or platform_is :windows } do | ||||||
|     it "returns the modification Time of the file with microseconds" do |     it "returns the modification Time of the file with microseconds" do | ||||||
|       supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10) |       supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10) | ||||||
|       if supports_subseconds != 0 |       if supports_subseconds != 0 | ||||||
|  |  | ||||||
|  | @ -623,13 +623,11 @@ describe "File.open" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "raises ArgumentError if mixing :newline and binary mode" do |   it "raises ArgumentError if mixing :newline and binary mode" do | ||||||
|     -> { |     -> { | ||||||
|       File.open(@file, "rb", newline: :universal) {} |       File.open(@file, "rb", newline: :universal) {} | ||||||
|     }.should raise_error(ArgumentError, "newline decorator with binary mode") |     }.should raise_error(ArgumentError, "newline decorator with binary mode") | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.6" do |   ruby_version_is "2.6" do | ||||||
|     context "'x' flag" do |     context "'x' flag" do | ||||||
|  |  | ||||||
|  | @ -50,7 +50,6 @@ describe :file_path, shared: true do | ||||||
|     @file.send(@method).encoding.should == Encoding.find("euc-jp") |     @file.send(@method).encoding.should == Encoding.find("euc-jp") | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   platform_is :linux do |   platform_is :linux do | ||||||
|     guard -> { defined?(File::TMPFILE) } do |     guard -> { defined?(File::TMPFILE) } do | ||||||
|       before :each do |       before :each do | ||||||
|  | @ -73,5 +72,4 @@ describe :file_path, shared: true do | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ describe "Float#<=>" do | ||||||
|     coercible.call_count.should == 3 |     coercible.call_count.should == 3 | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "raises TypeError when #coerce misbehaves" do |   it "raises TypeError when #coerce misbehaves" do | ||||||
|     klass = Class.new do |     klass = Class.new do | ||||||
|       def coerce(other) |       def coerce(other) | ||||||
|  | @ -46,7 +45,6 @@ describe "Float#<=>" do | ||||||
|       4.2 <=> bad_coercible |       4.2 <=> bad_coercible | ||||||
|     }.should raise_error(TypeError, "coerce must return [x, y]") |     }.should raise_error(TypeError, "coerce must return [x, y]") | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   # The 4 tests below are taken from matz's revision 23730 for Ruby trunk |   # The 4 tests below are taken from matz's revision 23730 for Ruby trunk | ||||||
|   # |   # | ||||||
|  |  | ||||||
|  | @ -1,27 +1,6 @@ | ||||||
| require_relative '../fixtures/classes' | require_relative '../fixtures/classes' | ||||||
| 
 | 
 | ||||||
| describe :float_arithmetic_exception_in_coerce, shared: true do | describe :float_arithmetic_exception_in_coerce, shared: true do | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "rescues exception (StandardError and subclasses) raised in other#coerce and raises TypeError" do |  | ||||||
|       b = mock("numeric with failed #coerce") |  | ||||||
|       b.should_receive(:coerce).and_raise(FloatSpecs::CoerceError) |  | ||||||
| 
 |  | ||||||
|       # e.g. 1.0 > b |  | ||||||
|       -> { 1.0.send(@method, b) }.should raise_error(TypeError, /MockObject can't be coerced into Float/) |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     it "does not rescue Exception and StandardError siblings raised in other#coerce" do |  | ||||||
|       [Exception, NoMemoryError].each do |exception| |  | ||||||
|         b = mock("numeric with failed #coerce") |  | ||||||
|         b.should_receive(:coerce).and_raise(exception) |  | ||||||
| 
 |  | ||||||
|         # e.g. 1.0 > b |  | ||||||
|         -> { 1.0.send(@method, b) }.should raise_error(exception) |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "does not rescue exception raised in other#coerce" do |   it "does not rescue exception raised in other#coerce" do | ||||||
|     b = mock("numeric with failed #coerce") |     b = mock("numeric with failed #coerce") | ||||||
|     b.should_receive(:coerce).and_raise(FloatSpecs::CoerceError) |     b.should_receive(:coerce).and_raise(FloatSpecs::CoerceError) | ||||||
|  | @ -29,5 +8,4 @@ describe :float_arithmetic_exception_in_coerce, shared: true do | ||||||
|     # e.g. 1.0 > b |     # e.g. 1.0 > b | ||||||
|     -> { 1.0.send(@method, b) }.should raise_error(FloatSpecs::CoerceError) |     -> { 1.0.send(@method, b) }.should raise_error(FloatSpecs::CoerceError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,29 +1,6 @@ | ||||||
| require_relative '../fixtures/classes' | require_relative '../fixtures/classes' | ||||||
| 
 | 
 | ||||||
| describe :float_comparison_exception_in_coerce, shared: true do | describe :float_comparison_exception_in_coerce, shared: true do | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "rescues exception (StandardError and subclasses) raised in other#coerce and raises ArgumentError" do |  | ||||||
|       b = mock("numeric with failed #coerce") |  | ||||||
|       b.should_receive(:coerce).and_raise(FloatSpecs::CoerceError) |  | ||||||
| 
 |  | ||||||
|       # e.g. 1.0 > b |  | ||||||
|       -> { |  | ||||||
|         -> { 1.0.send(@method, b) }.should raise_error(ArgumentError, /comparison of Float with MockObject failed/) |  | ||||||
|       }.should complain(/Numerical comparison operators will no more rescue exceptions of #coerce/) |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     it "does not rescue Exception and StandardError siblings raised in other#coerce" do |  | ||||||
|       [Exception, NoMemoryError].each do |exception| |  | ||||||
|         b = mock("numeric with failed #coerce") |  | ||||||
|         b.should_receive(:coerce).and_raise(exception) |  | ||||||
| 
 |  | ||||||
|         # e.g. 1.0 > b |  | ||||||
|         -> { 1.0.send(@method, b) }.should raise_error(exception) |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "does not rescue exception raised in other#coerce" do |   it "does not rescue exception raised in other#coerce" do | ||||||
|     b = mock("numeric with failed #coerce") |     b = mock("numeric with failed #coerce") | ||||||
|     b.should_receive(:coerce).and_raise(FloatSpecs::CoerceError) |     b.should_receive(:coerce).and_raise(FloatSpecs::CoerceError) | ||||||
|  | @ -31,5 +8,4 @@ describe :float_comparison_exception_in_coerce, shared: true do | ||||||
|     # e.g. 1.0 > b |     # e.g. 1.0 > b | ||||||
|     -> { 1.0.send(@method, b) }.should raise_error(FloatSpecs::CoerceError) |     -> { 1.0.send(@method, b) }.should raise_error(FloatSpecs::CoerceError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Hash#slice" do | ||||||
|   describe "Hash#slice" do |  | ||||||
|   before :each do |   before :each do | ||||||
|     @hash = { a: 1, b: 2, c: 3 } |     @hash = { a: 1, b: 2, c: 3 } | ||||||
|   end |   end | ||||||
|  | @ -51,5 +50,4 @@ ruby_version_is "2.5" do | ||||||
| 
 | 
 | ||||||
|     ScratchPad.recorded.should == [] |     ScratchPad.recorded.should == [] | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Hash#transform_keys" do | ||||||
|   describe "Hash#transform_keys" do |  | ||||||
|   before :each do |   before :each do | ||||||
|     @hash = { a: 1, b: 2, c: 3 } |     @hash = { a: 1, b: 2, c: 3 } | ||||||
|   end |   end | ||||||
|  | @ -43,9 +42,9 @@ ruby_version_is "2.5" do | ||||||
|     r.keys.should == [:xfoo] |     r.keys.should == [:xfoo] | ||||||
|     r.class.should == Hash |     r.class.should == Hash | ||||||
|   end |   end | ||||||
|   end | end | ||||||
| 
 | 
 | ||||||
|   describe "Hash#transform_keys!" do | describe "Hash#transform_keys!" do | ||||||
|   before :each do |   before :each do | ||||||
|     @hash = { a: 1, b: 2, c: 3, d: 4 } |     @hash = { a: 1, b: 2, c: 3, d: 4 } | ||||||
|     @initial_pairs = @hash.dup |     @initial_pairs = @hash.dup | ||||||
|  | @ -128,5 +127,4 @@ ruby_version_is "2.5" do | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe "Integer#allbits?" do | ||||||
|   describe "Integer#allbits?" do |  | ||||||
|   it "returns true iff all the bits of the argument are set in the receiver" do |   it "returns true iff all the bits of the argument are set in the receiver" do | ||||||
|     42.allbits?(42).should == true |     42.allbits?(42).should == true | ||||||
|     0b1010_1010.allbits?(0b1000_0010).should == true |     0b1010_1010.allbits?(0b1000_0010).should == true | ||||||
|  | @ -35,5 +34,4 @@ ruby_version_is '2.5' do | ||||||
|     -> { 13.allbits?("10")    }.should raise_error(TypeError) |     -> { 13.allbits?("10")    }.should raise_error(TypeError) | ||||||
|     -> { 13.allbits?(:symbol) }.should raise_error(TypeError) |     -> { 13.allbits?(:symbol) }.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe "Integer#anybits?" do | ||||||
|   describe "Integer#anybits?" do |  | ||||||
|   it "returns true iff all the bits of the argument are set in the receiver" do |   it "returns true iff all the bits of the argument are set in the receiver" do | ||||||
|     42.anybits?(42).should == true |     42.anybits?(42).should == true | ||||||
|     0b1010_1010.anybits?(0b1000_0010).should == true |     0b1010_1010.anybits?(0b1000_0010).should == true | ||||||
|  | @ -34,5 +33,4 @@ ruby_version_is '2.5' do | ||||||
|     -> { 13.anybits?("10")    }.should raise_error(TypeError) |     -> { 13.anybits?("10")    }.should raise_error(TypeError) | ||||||
|     -> { 13.anybits?(:symbol) }.should raise_error(TypeError) |     -> { 13.anybits?(:symbol) }.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -124,24 +124,12 @@ describe "Integer#<=>" do | ||||||
|         @big <=> @num |         @big <=> @num | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       ruby_version_is ""..."2.5" do |  | ||||||
|         it "returns nil if #coerce raises an exception" do |  | ||||||
|           @num.should_receive(:coerce).with(@big).and_raise(RuntimeError) |  | ||||||
|           -> { |  | ||||||
|             @result = (@big <=> @num) |  | ||||||
|           }.should complain(/Numerical comparison operators will no more rescue exceptions/) |  | ||||||
|           @result.should be_nil |  | ||||||
|         end |  | ||||||
|       end |  | ||||||
| 
 |  | ||||||
|       ruby_version_is "2.5" do |  | ||||||
|       it "lets the exception go through if #coerce raises an exception" do |       it "lets the exception go through if #coerce raises an exception" do | ||||||
|         @num.should_receive(:coerce).with(@big).and_raise(RuntimeError.new("my error")) |         @num.should_receive(:coerce).with(@big).and_raise(RuntimeError.new("my error")) | ||||||
|         -> { |         -> { | ||||||
|           @big <=> @num |           @big <=> @num | ||||||
|         }.should raise_error(RuntimeError, "my error") |         }.should raise_error(RuntimeError, "my error") | ||||||
|       end |       end | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       it "raises an exception if #coerce raises a non-StandardError exception" do |       it "raises an exception if #coerce raises a non-StandardError exception" do | ||||||
|         @num.should_receive(:coerce).with(@big).and_raise(Exception) |         @num.should_receive(:coerce).with(@big).and_raise(Exception) | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/arithmetic_coerce' | require_relative 'shared/arithmetic_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#/" do | describe "Integer#/" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_arithmetic_coerce_rescue, :/ |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_arithmetic_coerce_not_rescue, :/ |   it_behaves_like :integer_arithmetic_coerce_not_rescue, :/ | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns self divided by the given argument" do |     it "returns self divided by the given argument" do | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/comparison_coerce' | require_relative 'shared/comparison_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#>" do | describe "Integer#>" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_comparison_coerce_rescue, :> |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_comparison_coerce_not_rescue, :> |   it_behaves_like :integer_comparison_coerce_not_rescue, :> | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns true if self is greater than the given argument" do |     it "returns true if self is greater than the given argument" do | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/comparison_coerce' | require_relative 'shared/comparison_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#>=" do | describe "Integer#>=" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_comparison_coerce_rescue, :>= |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_comparison_coerce_not_rescue, :>= |   it_behaves_like :integer_comparison_coerce_not_rescue, :>= | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns true if self is greater than or equal to the given argument" do |     it "returns true if self is greater than or equal to the given argument" do | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/comparison_coerce' | require_relative 'shared/comparison_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#<" do | describe "Integer#<" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_comparison_coerce_rescue, :< |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_comparison_coerce_not_rescue, :< |   it_behaves_like :integer_comparison_coerce_not_rescue, :< | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns true if self is less than the given argument" do |     it "returns true if self is less than the given argument" do | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/comparison_coerce' | require_relative 'shared/comparison_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#<=" do | describe "Integer#<=" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_comparison_coerce_rescue, :<= |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_comparison_coerce_not_rescue, :<= |   it_behaves_like :integer_comparison_coerce_not_rescue, :<= | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns true if self is less than or equal to other" do |     it "returns true if self is less than or equal to other" do | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/arithmetic_coerce' | require_relative 'shared/arithmetic_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#-" do | describe "Integer#-" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_arithmetic_coerce_rescue, :- |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_arithmetic_coerce_not_rescue, :- |   it_behaves_like :integer_arithmetic_coerce_not_rescue, :- | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns self minus the given Integer" do |     it "returns self minus the given Integer" do | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/arithmetic_coerce' | require_relative 'shared/arithmetic_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#*" do | describe "Integer#*" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_arithmetic_coerce_rescue, :* |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_arithmetic_coerce_not_rescue, :* |   it_behaves_like :integer_arithmetic_coerce_not_rescue, :* | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns self multiplied by the given Integer" do |     it "returns self multiplied by the given Integer" do | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe "Integer#nobits?" do | ||||||
|   describe "Integer#nobits?" do |  | ||||||
|   it "returns true iff all no bits of the argument are set in the receiver" do |   it "returns true iff all no bits of the argument are set in the receiver" do | ||||||
|     42.nobits?(42).should == false |     42.nobits?(42).should == false | ||||||
|     0b1010_1010.nobits?(0b1000_0010).should == false |     0b1010_1010.nobits?(0b1000_0010).should == false | ||||||
|  | @ -34,5 +33,4 @@ ruby_version_is '2.5' do | ||||||
|     -> { 13.nobits?("10")    }.should raise_error(TypeError) |     -> { 13.nobits?("10")    }.should raise_error(TypeError) | ||||||
|     -> { 13.nobits?(:symbol) }.should raise_error(TypeError) |     -> { 13.nobits?(:symbol) }.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -2,13 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'shared/arithmetic_coerce' | require_relative 'shared/arithmetic_coerce' | ||||||
| 
 | 
 | ||||||
| describe "Integer#+" do | describe "Integer#+" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it_behaves_like :integer_arithmetic_coerce_rescue, :+ |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it_behaves_like :integer_arithmetic_coerce_not_rescue, :+ |   it_behaves_like :integer_arithmetic_coerce_not_rescue, :+ | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   context "fixnum" do |   context "fixnum" do | ||||||
|     it "returns self plus the given Integer" do |     it "returns self plus the given Integer" do | ||||||
|  |  | ||||||
|  | @ -2,8 +2,7 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/classes' | require_relative 'fixtures/classes' | ||||||
| require_relative 'shared/exponent' | require_relative 'shared/exponent' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Integer#pow" do | ||||||
|   describe "Integer#pow" do |  | ||||||
|   context "one argument is passed" do |   context "one argument is passed" do | ||||||
|     it_behaves_like :integer_exponent, :pow |     it_behaves_like :integer_exponent, :pow | ||||||
|   end |   end | ||||||
|  | @ -45,5 +44,4 @@ ruby_version_is "2.5" do | ||||||
|       -> { 2.pow(5, 0) }.should raise_error(ZeroDivisionError) |       -> { 2.pow(5, 0) }.should raise_error(ZeroDivisionError) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -6,14 +6,6 @@ describe "Integer#round" do | ||||||
|   it_behaves_like :integer_to_i, :round |   it_behaves_like :integer_to_i, :round | ||||||
|   it_behaves_like :integer_rounding_positive_precision, :round |   it_behaves_like :integer_rounding_positive_precision, :round | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do # Not just since 2.4 |  | ||||||
|     it "rounds itself as a float if passed a positive precision" do |  | ||||||
|       [2, -4, 10**70, -10**100].each do |v| |  | ||||||
|         v.round(42).should eql(v.to_f) |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   # redmine:5228 |   # redmine:5228 | ||||||
|   it "returns itself rounded if passed a negative value" do |   it "returns itself rounded if passed a negative value" do | ||||||
|     +249.round(-2).should eql(+200) |     +249.round(-2).should eql(+200) | ||||||
|  | @ -78,21 +70,11 @@ describe "Integer#round" do | ||||||
|     (-25).round(-1, half: nil).should   eql(-30) |     (-25).round(-1, half: nil).should   eql(-30) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it "returns itself as a float if passed a positive precision and the half option" do |  | ||||||
|       35.round(1, half: :up).should      eql(35.0) |  | ||||||
|       35.round(1, half: :down).should    eql(35.0) |  | ||||||
|       35.round(1, half: :even).should    eql(35.0) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns itself if passed a positive precision and the half option" do |   it "returns itself if passed a positive precision and the half option" do | ||||||
|     35.round(1, half: :up).should      eql(35) |     35.round(1, half: :up).should      eql(35) | ||||||
|     35.round(1, half: :down).should    eql(35) |     35.round(1, half: :down).should    eql(35) | ||||||
|     35.round(1, half: :even).should    eql(35) |     35.round(1, half: :even).should    eql(35) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "raises ArgumentError for an unknown rounding mode" do |   it "raises ArgumentError for an unknown rounding mode" do | ||||||
|     -> { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/) |     -> { 42.round(-1, half: :foo) }.should raise_error(ArgumentError, /invalid rounding mode: foo/) | ||||||
|  |  | ||||||
|  | @ -1,25 +1,5 @@ | ||||||
| require_relative '../fixtures/classes' | require_relative '../fixtures/classes' | ||||||
| 
 | 
 | ||||||
| describe :integer_arithmetic_coerce_rescue, shared: true do |  | ||||||
|   it "rescues exception (StandardError and subclasses) raised in other#coerce and raises TypeError" do |  | ||||||
|     b = mock("numeric with failed #coerce") |  | ||||||
|     b.should_receive(:coerce).and_raise(IntegerSpecs::CoerceError) |  | ||||||
| 
 |  | ||||||
|     # e.g. 1 + b |  | ||||||
|     -> { 1.send(@method, b) }.should raise_error(TypeError, /MockObject can't be coerced into Integer/) |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   it "does not rescue Exception and StandardError siblings raised in other#coerce" do |  | ||||||
|     [Exception, NoMemoryError].each do |exception| |  | ||||||
|       b = mock("numeric with failed #coerce") |  | ||||||
|       b.should_receive(:coerce).and_raise(exception) |  | ||||||
| 
 |  | ||||||
|       # e.g. 1 + b |  | ||||||
|       -> { 1.send(@method, b) }.should raise_error(exception) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| describe :integer_arithmetic_coerce_not_rescue, shared: true do | describe :integer_arithmetic_coerce_not_rescue, shared: true do | ||||||
|   it "does not rescue exception raised in other#coerce" do |   it "does not rescue exception raised in other#coerce" do | ||||||
|     b = mock("numeric with failed #coerce") |     b = mock("numeric with failed #coerce") | ||||||
|  |  | ||||||
|  | @ -11,19 +11,9 @@ describe :integer_rounding_positive_precision, shared: true do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it "returns itself as a float if passed a positive precision" do |  | ||||||
|       [2, -4, 10**70, -10**100].each do |v| |  | ||||||
|         v.send(@method, 42).should eql(v.to_f) |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns itself if passed a positive precision" do |   it "returns itself if passed a positive precision" do | ||||||
|     [2, -4, 10**70, -10**100].each do |v| |     [2, -4, 10**70, -10**100].each do |v| | ||||||
|       v.send(@method, 42).should eql(v) |       v.send(@method, 42).should eql(v) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Integer.sqrt" do | ||||||
|   describe "Integer.sqrt" do |  | ||||||
|   it "returns an integer" do |   it "returns an integer" do | ||||||
|     Integer.sqrt(10).should be_kind_of(Integer) |     Integer.sqrt(10).should be_kind_of(Integer) | ||||||
|   end |   end | ||||||
|  | @ -29,5 +28,4 @@ ruby_version_is "2.5" do | ||||||
|   it "raises a TypeError if the argument cannot be coerced to Integer" do |   it "raises a TypeError if the argument cannot be coerced to Integer" do | ||||||
|     -> { Integer.sqrt("test") }.should raise_error(TypeError) |     -> { Integer.sqrt("test") }.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -44,7 +44,6 @@ describe "IO#close" do | ||||||
|     @io.close.should be_nil |     @io.close.should be_nil | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it 'raises an IOError with a clear message' do |   it 'raises an IOError with a clear message' do | ||||||
|     read_io, write_io = IO.pipe |     read_io, write_io = IO.pipe | ||||||
|     going_to_read = false |     going_to_read = false | ||||||
|  | @ -60,7 +59,6 @@ describe "IO#close" do | ||||||
|     thread.join |     thread.join | ||||||
|     write_io.close |     write_io.close | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| describe "IO#close on an IO.popen stream" do | describe "IO#close on an IO.popen stream" do | ||||||
|  |  | ||||||
|  | @ -1,8 +1,7 @@ | ||||||
| # -*- encoding: utf-8 -*- | # -*- encoding: utf-8 -*- | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | platform_is_not :windows do | ||||||
|   platform_is_not :windows do |  | ||||||
|   describe "IO#pread" do |   describe "IO#pread" do | ||||||
|     before :each do |     before :each do | ||||||
|       @fname = tmp("io_pread.txt") |       @fname = tmp("io_pread.txt") | ||||||
|  | @ -48,5 +47,4 @@ ruby_version_is "2.5" do | ||||||
|       -> { file.pread(1, 1) }.should raise_error(IOError) |       -> { file.pread(1, 1) }.should raise_error(IOError) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,8 +1,7 @@ | ||||||
| # -*- encoding: utf-8 -*- | # -*- encoding: utf-8 -*- | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | platform_is_not :windows do | ||||||
|   platform_is_not :windows do |  | ||||||
|   describe "IO#pwrite" do |   describe "IO#pwrite" do | ||||||
|     before :each do |     before :each do | ||||||
|       @fname = tmp("io_pwrite.txt") |       @fname = tmp("io_pwrite.txt") | ||||||
|  | @ -41,5 +40,4 @@ ruby_version_is "2.5" do | ||||||
|       -> { file.pwrite("foo", 1) }.should raise_error(IOError) |       -> { file.pwrite("foo", 1) }.should raise_error(IOError) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -126,7 +126,6 @@ end | ||||||
| describe "IO#write" do | describe "IO#write" do | ||||||
|   it_behaves_like :io_write, :write |   it_behaves_like :io_write, :write | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "accepts multiple arguments" do |   it "accepts multiple arguments" do | ||||||
|     IO.pipe do |r, w| |     IO.pipe do |r, w| | ||||||
|       w.write("foo", "bar") |       w.write("foo", "bar") | ||||||
|  | @ -135,7 +134,6 @@ describe "IO#write" do | ||||||
|       r.read.should == "foobar" |       r.read.should == "foobar" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| platform_is :windows do | platform_is :windows do | ||||||
|  |  | ||||||
|  | @ -51,7 +51,6 @@ describe "Kernel#freeze" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe "on a Complex" do |   describe "on a Complex" do | ||||||
|     it "has no effect since it is already frozen" do |     it "has no effect since it is already frozen" do | ||||||
|       c = Complex(1.3, 3.1) |       c = Complex(1.3, 3.1) | ||||||
|  | @ -67,7 +66,6 @@ describe "Kernel#freeze" do | ||||||
|       r.freeze |       r.freeze | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "causes mutative calls to raise RuntimeError" do |   it "causes mutative calls to raise RuntimeError" do | ||||||
|     o = Class.new do |     o = Class.new do | ||||||
|  |  | ||||||
|  | @ -50,7 +50,6 @@ describe "Kernel#frozen?" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe "on a Complex" do |   describe "on a Complex" do | ||||||
|     it "returns true" do |     it "returns true" do | ||||||
|       c = Complex(1.3, 3.1) |       c = Complex(1.3, 3.1) | ||||||
|  | @ -74,5 +73,4 @@ describe "Kernel#frozen?" do | ||||||
|       r.frozen?.should be_true |       r.frozen?.should be_true | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,11 +1,9 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Kernel#pp" do | ||||||
|   describe "Kernel#pp" do |  | ||||||
|   it "lazily loads the 'pp' library and delegates the call to that library" do |   it "lazily loads the 'pp' library and delegates the call to that library" do | ||||||
|     # Run in child process to ensure 'pp' hasn't been loaded yet. |     # Run in child process to ensure 'pp' hasn't been loaded yet. | ||||||
|     output = ruby_exe("pp [1, 2, 3]") |     output = ruby_exe("pp [1, 2, 3]") | ||||||
|     output.should == "[1, 2, 3]\n" |     output.should == "[1, 2, 3]\n" | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -103,19 +103,6 @@ describe :kernel_dup_clone, shared: true do | ||||||
|     :my_symbol.send(@method).should == :my_symbol |     :my_symbol.send(@method).should == :my_symbol | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "raises a TypeError for Complex" do |  | ||||||
|       c = Complex(1.3, 3.1) |  | ||||||
|       -> { c.send(@method) }.should raise_error(TypeError) |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     it "raises a TypeError for Rational" do |  | ||||||
|       r = Rational(1, 3) |  | ||||||
|       -> { r.send(@method) }.should raise_error(TypeError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "returns self for Complex" do |   it "returns self for Complex" do | ||||||
|     c = Complex(1.3, 3.1) |     c = Complex(1.3, 3.1) | ||||||
|     c.send(@method).should equal c |     c.send(@method).should equal c | ||||||
|  | @ -125,5 +112,4 @@ describe :kernel_dup_clone, shared: true do | ||||||
|     r = Rational(1, 3) |     r = Rational(1, 3) | ||||||
|     r.send(@method).should equal r |     r.send(@method).should equal r | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -354,18 +354,6 @@ describe :kernel_require, shared: true do | ||||||
|           rm_r @dir, @symlink_to_dir |           rm_r @dir, @symlink_to_dir | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|         ruby_version_is ""..."2.4.4" do |  | ||||||
|           it "canonicalizes neither the entry in $LOAD_PATH nor the filename passed to #require" do |  | ||||||
|             $LOAD_PATH.unshift(@symlink_to_dir) |  | ||||||
|             @object.require("symfile").should be_true |  | ||||||
|             loaded_feature = "#{@symlink_to_dir}/symfile.rb" |  | ||||||
|             ScratchPad.recorded.should == [loaded_feature] |  | ||||||
|             $".last.should == loaded_feature |  | ||||||
|             $LOAD_PATH[0].should == @symlink_to_dir |  | ||||||
|           end |  | ||||||
|         end |  | ||||||
| 
 |  | ||||||
|         ruby_version_is "2.4.4" do |  | ||||||
|         it "canonicalizes the entry in $LOAD_PATH but not the filename passed to #require" do |         it "canonicalizes the entry in $LOAD_PATH but not the filename passed to #require" do | ||||||
|           $LOAD_PATH.unshift(@symlink_to_dir) |           $LOAD_PATH.unshift(@symlink_to_dir) | ||||||
|           @object.require("symfile").should be_true |           @object.require("symfile").should be_true | ||||||
|  | @ -376,7 +364,6 @@ describe :kernel_require, shared: true do | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|     end |  | ||||||
| 
 | 
 | ||||||
|     it "does not store the path if the load fails" do |     it "does not store the path if the load fails" do | ||||||
|       $LOAD_PATH << CODE_LOADING_DIR |       $LOAD_PATH << CODE_LOADING_DIR | ||||||
|  | @ -527,21 +514,6 @@ describe :kernel_require, shared: true do | ||||||
|       ScratchPad.recorded.should == [] |       ScratchPad.recorded.should == [] | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is ""..."2.5" do |  | ||||||
|       it "complex, enumerator, rational, thread and unicode_normalize are already required" do |  | ||||||
|         provided = %w[complex enumerator rational thread unicode_normalize] |  | ||||||
|         features = ruby_exe("puts $LOADED_FEATURES", options: '--disable-gems') |  | ||||||
|         provided.each { |feature| |  | ||||||
|           features.should =~ /\b#{feature}\.(rb|so|jar)$/ |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         code = provided.map { |f| "puts require #{f.inspect}\n" }.join |  | ||||||
|         required = ruby_exe(code, options: '--disable-gems') |  | ||||||
|         required.should == "false\n" * provided.size |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "complex, enumerator, rational and thread are already required" do |     it "complex, enumerator, rational and thread are already required" do | ||||||
|       provided = %w[complex enumerator rational thread] |       provided = %w[complex enumerator rational thread] | ||||||
|       features = ruby_exe("puts $LOADED_FEATURES", options: '--disable-gems') |       features = ruby_exe("puts $LOADED_FEATURES", options: '--disable-gems') | ||||||
|  | @ -563,7 +535,6 @@ describe :kernel_require, shared: true do | ||||||
|       -> { @object.require("unicode_normalize") }.should raise_error(LoadError) |       -> { @object.require("unicode_normalize") }.should raise_error(LoadError) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "(shell expansion)" do |   describe "(shell expansion)" do | ||||||
|     before :each do |     before :each do | ||||||
|  |  | ||||||
|  | @ -345,19 +345,11 @@ describe :kernel_sprintf, shared: true do | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     describe "%" do |     describe "%" do | ||||||
|       ruby_version_is ""..."2.5" do |  | ||||||
|         it "alone displays the percent sign" do |  | ||||||
|           @method.call("%").should == "%" |  | ||||||
|         end |  | ||||||
|       end |  | ||||||
| 
 |  | ||||||
|       ruby_version_is "2.5" do |  | ||||||
|       it "alone raises an ArgumentError" do |       it "alone raises an ArgumentError" do | ||||||
|         -> { |         -> { | ||||||
|           @method.call("%") |           @method.call("%") | ||||||
|         }.should raise_error(ArgumentError) |         }.should raise_error(ArgumentError) | ||||||
|       end |       end | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       it "is escaped by %" do |       it "is escaped by %" do | ||||||
|         @method.call("%%").should == "%" |         @method.call("%%").should == "%" | ||||||
|  | @ -876,7 +868,6 @@ describe :kernel_sprintf, shared: true do | ||||||
|       }.should raise_error(KeyError) |       }.should raise_error(KeyError) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "sets the Hash as the receiver of KeyError" do |     it "sets the Hash as the receiver of KeyError" do | ||||||
|       -> { |       -> { | ||||||
|         @method.call("%<foo>s", @object) |         @method.call("%<foo>s", @object) | ||||||
|  | @ -893,5 +884,4 @@ describe :kernel_sprintf, shared: true do | ||||||
|       } |       } | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -87,7 +87,6 @@ describe "Kernel#warn" do | ||||||
|     }.should output(nil, "to_s called\n") |     }.should output(nil, "to_s called\n") | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe ":uplevel keyword argument" do |   describe ":uplevel keyword argument" do | ||||||
|     before :each do |     before :each do | ||||||
|       $VERBOSE = true |       $VERBOSE = true | ||||||
|  | @ -153,5 +152,4 @@ describe "Kernel#warn" do | ||||||
|     -> { warn(**h) }.should_not complain(verbose: true) |     -> { warn(**h) }.should_not complain(verbose: true) | ||||||
|     -> { warn('foo', **h) }.should complain("foo\n") |     -> { warn('foo', **h) }.should complain("foo\n") | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,8 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'shared/then' | require_relative 'shared/then' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Kernel#yield_self" do | ||||||
|   describe "Kernel#yield_self" do |  | ||||||
|   it_behaves_like :kernel_then, :yield_self |   it_behaves_like :kernel_then, :yield_self | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -2,8 +2,6 @@ require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/classes' | require_relative 'fixtures/classes' | ||||||
| require_relative 'shared/call' | require_relative 'shared/call' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Method#===" do | ||||||
|   describe "Method#===" do |  | ||||||
|   it_behaves_like :method_call, :=== |   it_behaves_like :method_call, :=== | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -81,16 +81,9 @@ describe "Module#alias_method" do | ||||||
|     -> { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError) |     -> { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       -> { @class.alias_method :ichi, :public_one }.should raise_error(NoMethodError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:alias_method, false) |     Module.should have_public_instance_method(:alias_method, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "returns self" do |   it "returns self" do | ||||||
|     @class.send(:alias_method, :checking_return_value, :public_one).should equal(@class) |     @class.send(:alias_method, :checking_return_value, :public_one).should equal(@class) | ||||||
|  |  | ||||||
|  | @ -63,16 +63,9 @@ describe "Module#attr_accessor" do | ||||||
|     -> { c.new.foo=1 }.should raise_error(NoMethodError) |     -> { c.new.foo=1 }.should raise_error(NoMethodError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:attr_accessor, false) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:attr_accessor, false) |     Module.should have_public_instance_method(:attr_accessor, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "on immediates" do |   describe "on immediates" do | ||||||
|     before :each do |     before :each do | ||||||
|  |  | ||||||
|  | @ -58,14 +58,7 @@ describe "Module#attr_reader" do | ||||||
|     -> { c.new.foo }.should raise_error(NoMethodError) |     -> { c.new.foo }.should raise_error(NoMethodError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:attr_reader, false) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:attr_reader, false) |     Module.should have_public_instance_method(:attr_reader, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -142,14 +142,7 @@ describe "Module#attr" do | ||||||
|     }.should complain(/boolean argument is obsoleted/, verbose: true) |     }.should complain(/boolean argument is obsoleted/, verbose: true) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:attr, false) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:attr, false) |     Module.should have_public_instance_method(:attr, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -58,14 +58,7 @@ describe "Module#attr_writer" do | ||||||
|     -> { c.new.foo=1 }.should raise_error(NoMethodError) |     -> { c.new.foo=1 }.should raise_error(NoMethodError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:attr_writer, false) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:attr_writer, false) |     Module.should have_public_instance_method(:attr_writer, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -355,16 +355,9 @@ describe "Module#define_method" do | ||||||
|     klass.new.string_test.should == "string_test result" |     klass.new.string_test.should == "string_test result" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:define_method) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:define_method) |     Module.should have_public_instance_method(:define_method) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "returns its symbol" do |   it "returns its symbol" do | ||||||
|     class DefineMethodSpecClass |     class DefineMethodSpecClass | ||||||
|  |  | ||||||
|  | @ -393,27 +393,6 @@ describe "Module#refine" do | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is "" ... "2.5" do |  | ||||||
|       it "is not honored by string interpolation" do |  | ||||||
|         refinement = Module.new do |  | ||||||
|           refine Integer do |  | ||||||
|             def to_s |  | ||||||
|               "foo" |  | ||||||
|             end |  | ||||||
|           end |  | ||||||
|         end |  | ||||||
| 
 |  | ||||||
|         result = nil |  | ||||||
|         Module.new do |  | ||||||
|           using refinement |  | ||||||
|           result = "#{1}" |  | ||||||
|         end |  | ||||||
| 
 |  | ||||||
|         result.should == "1" |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "is honored by string interpolation" do |     it "is honored by string interpolation" do | ||||||
|       refinement = Module.new do |       refinement = Module.new do | ||||||
|         refine Integer do |         refine Integer do | ||||||
|  | @ -431,7 +410,6 @@ describe "Module#refine" do | ||||||
| 
 | 
 | ||||||
|       result.should == "foo" |       result.should == "foo" | ||||||
|     end |     end | ||||||
|     end |  | ||||||
| 
 | 
 | ||||||
|     it "is honored by Kernel#binding" do |     it "is honored by Kernel#binding" do | ||||||
|       refinement = Module.new do |       refinement = Module.new do | ||||||
|  |  | ||||||
|  | @ -20,16 +20,9 @@ describe "Module#remove_method" do | ||||||
|     @module = Module.new { def method_to_remove; end } |     @module = Module.new { def method_to_remove; end } | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:remove_method, false) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:remove_method, false) |     Module.should have_public_instance_method(:remove_method, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "removes the method from a class" do |   it "removes the method from a class" do | ||||||
|     klass = Class.new do |     klass = Class.new do | ||||||
|  |  | ||||||
|  | @ -18,16 +18,9 @@ describe "Module#undef_method" do | ||||||
|     @module = Module.new { def method_to_undef; end } |     @module = Module.new { def method_to_undef; end } | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "is a private method" do |  | ||||||
|       Module.should have_private_instance_method(:undef_method, false) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "is a public method" do |   it "is a public method" do | ||||||
|     Module.should have_public_instance_method(:undef_method, false) |     Module.should have_public_instance_method(:undef_method, false) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "requires multiple arguments" do |   it "requires multiple arguments" do | ||||||
|     Module.instance_method(:undef_method).arity.should < 0 |     Module.instance_method(:undef_method).arity.should < 0 | ||||||
|  |  | ||||||
|  | @ -224,33 +224,25 @@ describe :numeric_step, :shared => true do | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   describe "when step is a String" do |   describe "when step is a String" do | ||||||
|     error = nil |  | ||||||
|     ruby_version_is "2.4"..."2.5" do |  | ||||||
|       error = TypeError |  | ||||||
|     end |  | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|       error = ArgumentError |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     describe "with self and stop as Fixnums" do |     describe "with self and stop as Fixnums" do | ||||||
|       it "raises an #{error} when step is a numeric representation" do |       it "raises an ArgumentError when step is a numeric representation" do | ||||||
|         -> { @step.call(1, 5, "1") {} }.should raise_error(error) |         -> { @step.call(1, 5, "1") {} }.should raise_error(ArgumentError) | ||||||
|         -> { @step.call(1, 5, "0.1") {} }.should raise_error(error) |         -> { @step.call(1, 5, "0.1") {} }.should raise_error(ArgumentError) | ||||||
|         -> { @step.call(1, 5, "1/3") {} }.should raise_error(error) |         -> { @step.call(1, 5, "1/3") {} }.should raise_error(ArgumentError) | ||||||
|       end |       end | ||||||
|       it "raises an #{error} with step as an alphanumeric string" do |       it "raises an ArgumentError with step as an alphanumeric string" do | ||||||
|         -> { @step.call(1, 5, "foo") {} }.should raise_error(error) |         -> { @step.call(1, 5, "foo") {} }.should raise_error(ArgumentError) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     describe "with self and stop as Floats" do |     describe "with self and stop as Floats" do | ||||||
|       it "raises an #{error} when step is a numeric representation" do |       it "raises an ArgumentError when step is a numeric representation" do | ||||||
|         -> { @step.call(1.1, 5.1, "1") {} }.should raise_error(error) |         -> { @step.call(1.1, 5.1, "1") {} }.should raise_error(ArgumentError) | ||||||
|         -> { @step.call(1.1, 5.1, "0.1") {} }.should raise_error(error) |         -> { @step.call(1.1, 5.1, "0.1") {} }.should raise_error(ArgumentError) | ||||||
|         -> { @step.call(1.1, 5.1, "1/3") {} }.should raise_error(error) |         -> { @step.call(1.1, 5.1, "1/3") {} }.should raise_error(ArgumentError) | ||||||
|       end |       end | ||||||
|       it "raises an #{error} with step as an alphanumeric string" do |       it "raises an ArgumentError with step as an alphanumeric string" do | ||||||
|         -> { @step.call(1.1, 5.1, "foo") {} }.should raise_error(error) |         -> { @step.call(1.1, 5.1, "foo") {} }.should raise_error(ArgumentError) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  | @ -302,33 +294,25 @@ describe :numeric_step, :shared => true do | ||||||
|     describe "returned Enumerator" do |     describe "returned Enumerator" do | ||||||
|       describe "size" do |       describe "size" do | ||||||
|         describe "when step is a String" do |         describe "when step is a String" do | ||||||
|           error = nil |  | ||||||
|           ruby_version_is "2.4"..."2.5" do |  | ||||||
|             error = TypeError |  | ||||||
|           end |  | ||||||
|           ruby_version_is "2.5" do |  | ||||||
|             error = ArgumentError |  | ||||||
|           end |  | ||||||
| 
 |  | ||||||
|           describe "with self and stop as Fixnums" do |           describe "with self and stop as Fixnums" do | ||||||
|             it "raises an #{error} when step is a numeric representation" do |             it "raises an ArgumentError when step is a numeric representation" do | ||||||
|               -> { @step.call(1, 5, "1").size }.should raise_error(error) |               -> { @step.call(1, 5, "1").size }.should raise_error(ArgumentError) | ||||||
|               -> { @step.call(1, 5, "0.1").size }.should raise_error(error) |               -> { @step.call(1, 5, "0.1").size }.should raise_error(ArgumentError) | ||||||
|               -> { @step.call(1, 5, "1/3").size }.should raise_error(error) |               -> { @step.call(1, 5, "1/3").size }.should raise_error(ArgumentError) | ||||||
|             end |             end | ||||||
|             it "raises an #{error} with step as an alphanumeric string" do |             it "raises an ArgumentError with step as an alphanumeric string" do | ||||||
|               -> { @step.call(1, 5, "foo").size }.should raise_error(error) |               -> { @step.call(1, 5, "foo").size }.should raise_error(ArgumentError) | ||||||
|             end |             end | ||||||
|           end |           end | ||||||
| 
 | 
 | ||||||
|           describe "with self and stop as Floats" do |           describe "with self and stop as Floats" do | ||||||
|             it "raises an #{error} when step is a numeric representation" do |             it "raises an ArgumentError when step is a numeric representation" do | ||||||
|               -> { @step.call(1.1, 5.1, "1").size }.should raise_error(error) |               -> { @step.call(1.1, 5.1, "1").size }.should raise_error(ArgumentError) | ||||||
|               -> { @step.call(1.1, 5.1, "0.1").size }.should raise_error(error) |               -> { @step.call(1.1, 5.1, "0.1").size }.should raise_error(ArgumentError) | ||||||
|               -> { @step.call(1.1, 5.1, "1/3").size }.should raise_error(error) |               -> { @step.call(1.1, 5.1, "1/3").size }.should raise_error(ArgumentError) | ||||||
|             end |             end | ||||||
|             it "raises an #{error} with step as an alphanumeric string" do |             it "raises an ArgumentError with step as an alphanumeric string" do | ||||||
|               -> { @step.call(1.1, 5.1, "foo").size }.should raise_error(error) |               -> { @step.call(1.1, 5.1, "foo").size }.should raise_error(ArgumentError) | ||||||
|             end |             end | ||||||
|           end |           end | ||||||
|         end |         end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe 'Process#last_status' do | ||||||
|   describe 'Process#last_status' do |  | ||||||
|   it 'returns the status of the last executed child process in the current thread' do |   it 'returns the status of the last executed child process in the current thread' do | ||||||
|     pid = Process.wait Process.spawn("exit 0") |     pid = Process.wait Process.spawn("exit 0") | ||||||
|     Process.last_status.pid.should == pid |     Process.last_status.pid.should == pid | ||||||
|  | @ -16,5 +15,4 @@ ruby_version_is '2.5' do | ||||||
|   it 'raises an ArgumentError if any arguments are provided' do |   it 'raises an ArgumentError if any arguments are provided' do | ||||||
|     -> { Process.last_status(1) }.should raise_error(ArgumentError) |     -> { Process.last_status(1) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ describe "Process.times" do | ||||||
|     Process.times.utime.should > user |     Process.times.utime.should > user | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   platform_is_not :windows do |   platform_is_not :windows do | ||||||
|     it "uses getrusage when available to improve precision beyond milliseconds" do |     it "uses getrusage when available to improve precision beyond milliseconds" do | ||||||
|       max = 10_000 |       max = 10_000 | ||||||
|  | @ -33,5 +32,4 @@ describe "Process.times" do | ||||||
|       found.should_not == nil |       found.should_not == nil | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,9 +1,6 @@ | ||||||
| # -*- encoding: binary -*- |  | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'shared/urandom' | require_relative 'shared/urandom' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Random.urandom" do | ||||||
|   describe "Random.urandom" do |  | ||||||
|   it_behaves_like :random_urandom, :urandom |   it_behaves_like :random_urandom, :urandom | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,9 +0,0 @@ | ||||||
| # -*- encoding: binary -*- |  | ||||||
| require_relative '../../spec_helper' |  | ||||||
| require_relative 'shared/urandom' |  | ||||||
| 
 |  | ||||||
| ruby_version_is ""..."2.5" do |  | ||||||
|   describe "Random.raw_seed" do |  | ||||||
|     it_behaves_like :random_urandom, :raw_seed |  | ||||||
|   end |  | ||||||
| end |  | ||||||
|  | @ -33,7 +33,6 @@ describe "Range.new" do | ||||||
|     -> { Range.new(a, b) }.should raise_error(ArgumentError) |     -> { Range.new(a, b) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "does not rescue exception raised in #<=> when compares the given start and end" do |   it "does not rescue exception raised in #<=> when compares the given start and end" do | ||||||
|     b = mock('a') |     b = mock('a') | ||||||
|     a = mock('b') |     a = mock('b') | ||||||
|  | @ -41,7 +40,6 @@ describe "Range.new" do | ||||||
| 
 | 
 | ||||||
|     -> { Range.new(a, b) }.should raise_error(RangeSpecs::ComparisonError) |     -> { Range.new(a, b) }.should raise_error(RangeSpecs::ComparisonError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "beginless/endless range" do |   describe "beginless/endless range" do | ||||||
|     ruby_version_is ""..."2.7" do |     ruby_version_is ""..."2.7" do | ||||||
|  |  | ||||||
|  | @ -25,17 +25,9 @@ describe "String#casecmp independent of case" do | ||||||
|     "abc".casecmp(other).should == 0 |     "abc".casecmp(other).should == 0 | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "raises a TypeError if other can't be converted to a string" do |  | ||||||
|       -> { "abc".casecmp(mock('abc')) }.should raise_error(TypeError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns nil if other can't be converted to a string" do |   it "returns nil if other can't be converted to a string" do | ||||||
|     "abc".casecmp(mock('abc')).should be_nil |     "abc".casecmp(mock('abc')).should be_nil | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "returns nil if incompatible encodings" do |   it "returns nil if incompatible encodings" do | ||||||
|     "あれ".casecmp("れ".encode(Encoding::EUC_JP)).should be_nil |     "あれ".casecmp("れ".encode(Encoding::EUC_JP)).should be_nil | ||||||
|  | @ -196,15 +188,7 @@ describe 'String#casecmp? independent of case' do | ||||||
|     "ß".casecmp?("ss").should be_true |     "ß".casecmp?("ss").should be_true | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it "raises a TypeError if other can't be converted to a string" do |  | ||||||
|       -> { "abc".casecmp?(mock('abc')) }.should raise_error(TypeError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns nil if other can't be converted to a string" do |   it "returns nil if other can't be converted to a string" do | ||||||
|     "abc".casecmp?(mock('abc')).should be_nil |     "abc".casecmp?(mock('abc')).should be_nil | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -2,8 +2,7 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/classes' | require_relative 'fixtures/classes' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe "String#delete_prefix" do | ||||||
|   describe "String#delete_prefix" do |  | ||||||
|   it "returns a copy of the string, with the given prefix removed" do |   it "returns a copy of the string, with the given prefix removed" do | ||||||
|     'hello'.delete_prefix('hell').should == 'o' |     'hello'.delete_prefix('hell').should == 'o' | ||||||
|     'hello'.delete_prefix('hello').should == '' |     'hello'.delete_prefix('hello').should == '' | ||||||
|  | @ -46,9 +45,9 @@ ruby_version_is '2.5' do | ||||||
|     s = StringSpecs::MyString.new('hello') |     s = StringSpecs::MyString.new('hello') | ||||||
|     s.delete_prefix('hell').should be_an_instance_of(StringSpecs::MyString) |     s.delete_prefix('hell').should be_an_instance_of(StringSpecs::MyString) | ||||||
|   end |   end | ||||||
|   end | end | ||||||
| 
 | 
 | ||||||
|   describe "String#delete_prefix!" do | describe "String#delete_prefix!" do | ||||||
|   it "removes the found prefix" do |   it "removes the found prefix" do | ||||||
|     s = 'hello' |     s = 'hello' | ||||||
|     s.delete_prefix!('hell').should equal(s) |     s.delete_prefix!('hell').should equal(s) | ||||||
|  | @ -79,5 +78,4 @@ ruby_version_is '2.5' do | ||||||
|     -> { 'hello'.freeze.delete_prefix!('') }.should raise_error(FrozenError) |     -> { 'hello'.freeze.delete_prefix!('') }.should raise_error(FrozenError) | ||||||
|     -> { ''.freeze.delete_prefix!('') }.should raise_error(FrozenError) |     -> { ''.freeze.delete_prefix!('') }.should raise_error(FrozenError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -2,8 +2,7 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/classes' | require_relative 'fixtures/classes' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe "String#delete_suffix" do | ||||||
|   describe "String#delete_suffix" do |  | ||||||
|   it "returns a copy of the string, with the given suffix removed" do |   it "returns a copy of the string, with the given suffix removed" do | ||||||
|     'hello'.delete_suffix('ello').should == 'h' |     'hello'.delete_suffix('ello').should == 'h' | ||||||
|     'hello'.delete_suffix('hello').should == '' |     'hello'.delete_suffix('hello').should == '' | ||||||
|  | @ -46,9 +45,9 @@ ruby_version_is '2.5' do | ||||||
|     s = StringSpecs::MyString.new('hello') |     s = StringSpecs::MyString.new('hello') | ||||||
|     s.delete_suffix('ello').should be_an_instance_of(StringSpecs::MyString) |     s.delete_suffix('ello').should be_an_instance_of(StringSpecs::MyString) | ||||||
|   end |   end | ||||||
|   end | end | ||||||
| 
 | 
 | ||||||
|   describe "String#delete_suffix!" do | describe "String#delete_suffix!" do | ||||||
|   it "removes the found prefix" do |   it "removes the found prefix" do | ||||||
|     s = 'hello' |     s = 'hello' | ||||||
|     s.delete_suffix!('ello').should equal(s) |     s.delete_suffix!('ello').should equal(s) | ||||||
|  | @ -79,5 +78,4 @@ ruby_version_is '2.5' do | ||||||
|     -> { 'hello'.freeze.delete_suffix!('') }.should raise_error(FrozenError) |     -> { 'hello'.freeze.delete_suffix!('') }.should raise_error(FrozenError) | ||||||
|     -> { ''.freeze.delete_suffix!('') }.should raise_error(FrozenError) |     -> { ''.freeze.delete_suffix!('') }.should raise_error(FrozenError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -2,10 +2,8 @@ require_relative 'shared/chars' | ||||||
| require_relative 'shared/grapheme_clusters' | require_relative 'shared/grapheme_clusters' | ||||||
| require_relative 'shared/each_char_without_block' | require_relative 'shared/each_char_without_block' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "String#each_grapheme_cluster" do | ||||||
|   describe "String#each_grapheme_cluster" do |  | ||||||
|   it_behaves_like :string_chars, :each_grapheme_cluster |   it_behaves_like :string_chars, :each_grapheme_cluster | ||||||
|   it_behaves_like :string_grapheme_clusters, :each_grapheme_cluster |   it_behaves_like :string_grapheme_clusters, :each_grapheme_cluster | ||||||
|   it_behaves_like :string_each_char_without_block, :each_grapheme_cluster |   it_behaves_like :string_each_char_without_block, :each_grapheme_cluster | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,8 +1,7 @@ | ||||||
| require_relative 'shared/chars' | require_relative 'shared/chars' | ||||||
| require_relative 'shared/grapheme_clusters' | require_relative 'shared/grapheme_clusters' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "String#grapheme_clusters" do | ||||||
|   describe "String#grapheme_clusters" do |  | ||||||
|   it_behaves_like :string_chars, :grapheme_clusters |   it_behaves_like :string_chars, :grapheme_clusters | ||||||
|   it_behaves_like :string_grapheme_clusters, :grapheme_clusters |   it_behaves_like :string_grapheme_clusters, :grapheme_clusters | ||||||
| 
 | 
 | ||||||
|  | @ -11,5 +10,4 @@ ruby_version_is "2.5" do | ||||||
|     string.grapheme_clusters.should == ['a', 'b', "\u{1f3f3}\u{fe0f}\u{200d}\u{1f308}", "\u{1F43E}"] |     string.grapheme_clusters.should == ['a', 'b', "\u{1f3f3}\u{fe0f}\u{200d}\u{1f308}", "\u{1F43E}"] | ||||||
| 
 | 
 | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -50,19 +50,10 @@ describe "String#%" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "formats single % character at the end as literal %" do |  | ||||||
|       ("%" % []).should == "%" |  | ||||||
|       ("foo%" % []).should == "foo%" |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "raises an error if single % appears at the end" do |   it "raises an error if single % appears at the end" do | ||||||
|     -> { ("%" % []) }.should raise_error(ArgumentError) |     -> { ("%" % []) }.should raise_error(ArgumentError) | ||||||
|     -> { ("foo%" % [])}.should raise_error(ArgumentError) |     -> { ("foo%" % [])}.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "formats single % character before a newline as literal %" do |   it "formats single % character before a newline as literal %" do | ||||||
|     ("%\n" % []).should == "%\n" |     ("%\n" % []).should == "%\n" | ||||||
|  |  | ||||||
|  | @ -54,19 +54,6 @@ describe :string_each_line, shared: true do | ||||||
|     a.should == ["one\ntwo\r\nthree"] |     a.should == ["one\ntwo\r\nthree"] | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ''...'2.5' do |  | ||||||
|     it "yields paragraphs (broken by 2 or more successive newlines) when passed ''" do |  | ||||||
|       a = [] |  | ||||||
|       "hello\nworld\n\n\nand\nuniverse\n\n\n\n\n".send(@method, '') { |s| a << s } |  | ||||||
|       a.should == ["hello\nworld\n\n\n", "and\nuniverse\n\n\n\n\n"] |  | ||||||
| 
 |  | ||||||
|       a = [] |  | ||||||
|       "hello\nworld\n\n\nand\nuniverse\n\n\n\n\ndog".send(@method, '') { |s| a << s } |  | ||||||
|       a.should == ["hello\nworld\n\n\n", "and\nuniverse\n\n\n\n\n", "dog"] |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is '2.5' do |  | ||||||
|   it "yields paragraphs (broken by 2 or more successive newlines) when passed '' and replaces multiple newlines with only two ones" do |   it "yields paragraphs (broken by 2 or more successive newlines) when passed '' and replaces multiple newlines with only two ones" do | ||||||
|     a = [] |     a = [] | ||||||
|     "hello\nworld\n\n\nand\nuniverse\n\n\n\n\n".send(@method, '') { |s| a << s } |     "hello\nworld\n\n\nand\nuniverse\n\n\n\n\n".send(@method, '') { |s| a << s } | ||||||
|  | @ -76,7 +63,6 @@ describe :string_each_line, shared: true do | ||||||
|     "hello\nworld\n\n\nand\nuniverse\n\n\n\n\ndog".send(@method, '') { |s| a << s } |     "hello\nworld\n\n\nand\nuniverse\n\n\n\n\ndog".send(@method, '') { |s| a << s } | ||||||
|     a.should == ["hello\nworld\n\n", "and\nuniverse\n\n", "dog"] |     a.should == ["hello\nworld\n\n", "and\nuniverse\n\n", "dog"] | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "uses $/" do |   describe "uses $/" do | ||||||
|     before :each do |     before :each do | ||||||
|  |  | ||||||
|  | @ -43,7 +43,6 @@ describe "String#start_with?" do | ||||||
|     "céréale".should.start_with?("cér") |     "céréale".should.start_with?("cér") | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "supports regexps" do |   it "supports regexps" do | ||||||
|     regexp = /[h1]/ |     regexp = /[h1]/ | ||||||
|     "hello".should.start_with?(regexp) |     "hello".should.start_with?(regexp) | ||||||
|  | @ -72,5 +71,4 @@ describe "String#start_with?" do | ||||||
|     Regexp.last_match.should be_nil |     Regexp.last_match.should be_nil | ||||||
|     $1.should be_nil |     $1.should be_nil | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -18,7 +18,6 @@ describe 'String#-@' do | ||||||
|     output.should == 'foo' |     output.should == 'foo' | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns the same object for equal unfrozen strings" do |   it "returns the same object for equal unfrozen strings" do | ||||||
|     origin = "this is a string" |     origin = "this is a string" | ||||||
|     dynamic = %w(this is a string).join(' ') |     dynamic = %w(this is a string).join(' ') | ||||||
|  | @ -31,9 +30,8 @@ describe 'String#-@' do | ||||||
|     (-"unfrozen string").should equal(-"unfrozen string") |     (-"unfrozen string").should equal(-"unfrozen string") | ||||||
|     (-"unfrozen string").should_not equal(-"another unfrozen string") |     (-"unfrozen string").should_not equal(-"another unfrozen string") | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5"..."2.6" do |   ruby_version_is ""..."2.6" do | ||||||
|     it "does not deduplicate already frozen strings" do |     it "does not deduplicate already frozen strings" do | ||||||
|       dynamic = %w(this string is frozen).join(' ').freeze |       dynamic = %w(this string is frozen).join(' ').freeze | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,8 +2,7 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'fixtures/classes' | require_relative 'fixtures/classes' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe "String#undump" do | ||||||
|   describe "String#undump" do |  | ||||||
|   ruby_version_is ''...'2.7' do |   ruby_version_is ''...'2.7' do | ||||||
|     it "taints the result if self is tainted" do |     it "taints the result if self is tainted" do | ||||||
|       '"foo"'.taint.undump.tainted?.should == true |       '"foo"'.taint.undump.tainted?.should == true | ||||||
|  | @ -449,5 +448,4 @@ ruby_version_is '2.5' do | ||||||
|       -> { '" "" "'.undump }.should raise_error(RuntimeError, /invalid dumped string/) |       -> { '" "" "'.undump }.should raise_error(RuntimeError, /invalid dumped string/) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -25,7 +25,6 @@ describe "Struct#hash" do | ||||||
|     s1.hash.should_not == s2.hash |     s1.hash.should_not == s2.hash | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns different hashes for structs with different values when using keyword_init: true" do |   it "returns different hashes for structs with different values when using keyword_init: true" do | ||||||
|     key = :"1 non symbol member" |     key = :"1 non symbol member" | ||||||
|     struct_class = Struct.new(key, keyword_init: true) |     struct_class = Struct.new(key, keyword_init: true) | ||||||
|  | @ -33,7 +32,6 @@ describe "Struct#hash" do | ||||||
|     t2 = struct_class.new(key => 2) |     t2 = struct_class.new(key => 2) | ||||||
|     t1.hash.should_not == t2.hash |     t1.hash.should_not == t2.hash | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "allows for overriding methods in an included module" do |   it "allows for overriding methods in an included module" do | ||||||
|     mod = Module.new do |     mod = Module.new do | ||||||
|  |  | ||||||
|  | @ -62,17 +62,9 @@ describe "Struct.new" do | ||||||
|     -> { Struct.new(:animal, ['chris', 'evan'])    }.should raise_error(TypeError) |     -> { Struct.new(:animal, ['chris', 'evan'])    }.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "raises a TypeError if an argument is a Hash" do |  | ||||||
|       -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(TypeError) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "raises a ArgumentError if passed a Hash with an unknown key" do |   it "raises a ArgumentError if passed a Hash with an unknown key" do | ||||||
|     -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError) |     -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "raises ArgumentError when there is a duplicate member" do |   it "raises ArgumentError when there is a duplicate member" do | ||||||
|     -> { Struct.new(:foo, :foo) }.should raise_error(ArgumentError, "duplicate member: foo") |     -> { Struct.new(:foo, :foo) }.should raise_error(ArgumentError, "duplicate member: foo") | ||||||
|  | @ -147,7 +139,6 @@ describe "Struct.new" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   context "keyword_init: true option" do |   context "keyword_init: true option" do | ||||||
|     before :all do |     before :all do | ||||||
|       @struct_with_kwa = Struct.new(:name, :legs, keyword_init: true) |       @struct_with_kwa = Struct.new(:name, :legs, keyword_init: true) | ||||||
|  | @ -213,5 +204,4 @@ describe "Struct.new" do | ||||||
|       obj.legs.should == 4 |       obj.legs.should == 4 | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| ruby_version_is '2.5' do | describe 'Thread#fetch' do | ||||||
|   describe 'Thread#fetch' do |  | ||||||
|   describe 'with 2 arguments' do |   describe 'with 2 arguments' do | ||||||
|     it 'returns the value of the fiber-local variable if value has been assigned' do |     it 'returns the value of the fiber-local variable if value has been assigned' do | ||||||
|       th = Thread.new { Thread.current[:cat] = 'meow' } |       th = Thread.new { Thread.current[:cat] = 'meow' } | ||||||
|  | @ -34,5 +33,4 @@ ruby_version_is '2.5' do | ||||||
|     -> { Thread.current.fetch() }.should raise_error(ArgumentError) |     -> { Thread.current.fetch() }.should raise_error(ArgumentError) | ||||||
|     -> { Thread.current.fetch(1, 2, 3) }.should raise_error(ArgumentError) |     -> { Thread.current.fetch(1, 2, 3) }.should raise_error(ArgumentError) | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -1,17 +1,9 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| 
 | 
 | ||||||
| describe "Thread.report_on_exception" do | describe "Thread.report_on_exception" do | ||||||
|   ruby_version_is "2.4"..."2.5" do |  | ||||||
|     it "defaults to false" do |  | ||||||
|       ruby_exe("p Thread.report_on_exception").should == "false\n" |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "defaults to true" do |   it "defaults to true" do | ||||||
|     ruby_exe("p Thread.report_on_exception").should == "true\n" |     ruby_exe("p Thread.report_on_exception").should == "true\n" | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| describe "Thread.report_on_exception=" do | describe "Thread.report_on_exception=" do | ||||||
|  | @ -33,7 +25,6 @@ describe "Thread.report_on_exception=" do | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| describe "Thread#report_on_exception" do | describe "Thread#report_on_exception" do | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns true for the main Thread" do |   it "returns true for the main Thread" do | ||||||
|     Thread.current.report_on_exception.should == true |     Thread.current.report_on_exception.should == true | ||||||
|   end |   end | ||||||
|  | @ -41,7 +32,6 @@ describe "Thread#report_on_exception" do | ||||||
|   it "returns true for new Threads" do |   it "returns true for new Threads" do | ||||||
|     Thread.new { Thread.current.report_on_exception }.value.should == true |     Thread.new { Thread.current.report_on_exception }.value.should == true | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "returns whether the Thread will print a backtrace if it exits with an exception" do |   it "returns whether the Thread will print a backtrace if it exits with an exception" do | ||||||
|     t = Thread.new { Thread.current.report_on_exception = true } |     t = Thread.new { Thread.current.report_on_exception = true } | ||||||
|  |  | ||||||
|  | @ -1,8 +1,6 @@ | ||||||
| require_relative '../../spec_helper' | require_relative '../../spec_helper' | ||||||
| require_relative 'shared/to_s' | require_relative 'shared/to_s' | ||||||
| 
 | 
 | ||||||
| ruby_version_is "2.5" do | describe "Thread#to_s" do | ||||||
|   describe "Thread#to_s" do |  | ||||||
|   it_behaves_like :thread_to_s, :to_s |   it_behaves_like :thread_to_s, :to_s | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -144,7 +144,6 @@ describe "Time.at" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   describe "passed [Time, Numeric, format]" do |   describe "passed [Time, Numeric, format]" do | ||||||
|     context ":nanosecond format" do |     context ":nanosecond format" do | ||||||
|       it "treats second argument as nanoseconds" do |       it "treats second argument as nanoseconds" do | ||||||
|  | @ -198,7 +197,6 @@ describe "Time.at" do | ||||||
|       Time.at(0, 123.500, :millisecond).nsec.should == 123500000 |       Time.at(0, 123.500, :millisecond).nsec.should == 123500000 | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.6" do |   ruby_version_is "2.6" do | ||||||
|     describe ":in keyword argument" do |     describe ":in keyword argument" do | ||||||
|  |  | ||||||
|  | @ -18,7 +18,6 @@ describe :time_now, shared: true do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   guard_not -> { platform_is :windows and ruby_version_is ""..."2.5" } do |  | ||||||
|   it "has at least microsecond precision" do |   it "has at least microsecond precision" do | ||||||
|     times = [] |     times = [] | ||||||
|     10_000.times do |     10_000.times do | ||||||
|  | @ -31,5 +30,4 @@ describe :time_now, shared: true do | ||||||
|     expected = 1_000 |     expected = 1_000 | ||||||
|     times.select { |t| t % (expected * 10) == 0  }.size.should_not == times.size |     times.select { |t| t % (expected * 10) == 0  }.size.should_not == times.size | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -55,11 +55,9 @@ describe 'TracePoint.new' do | ||||||
|     -> { TracePoint.new(o) {}}.should raise_error(TypeError) |     -> { TracePoint.new(o) {}}.should raise_error(TypeError) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it 'expects to be called with a block' do |   it 'expects to be called with a block' do | ||||||
|     -> { TracePoint.new(:line) }.should raise_error(ArgumentError, "must be called with a block") |     -> { TracePoint.new(:line) }.should raise_error(ArgumentError, "must be called with a block") | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "raises a Argument error when the given argument doesn't match an event name" do |   it "raises a Argument error when the given argument doesn't match an event name" do | ||||||
|     -> { TracePoint.new(:test) }.should raise_error(ArgumentError, "unknown event: test") |     -> { TracePoint.new(:test) }.should raise_error(ArgumentError, "unknown event: test") | ||||||
|  |  | ||||||
|  | @ -51,7 +51,6 @@ describe "Warning.warn" do | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "is called by Kernel.warn" do |   it "is called by Kernel.warn" do | ||||||
|     Warning.should_receive(:warn).with("Chunky bacon!\n") |     Warning.should_receive(:warn).with("Chunky bacon!\n") | ||||||
|     verbose = $VERBOSE |     verbose = $VERBOSE | ||||||
|  | @ -62,5 +61,4 @@ describe "Warning.warn" do | ||||||
|       $VERBOSE = verbose |       $VERBOSE = verbose | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -317,12 +317,10 @@ describe "A block" do | ||||||
|       @y.s(0) { 1 }.should == 1 |       @y.s(0) { 1 }.should == 1 | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "may include a rescue clause" do |     it "may include a rescue clause" do | ||||||
|       eval("@y.z do raise ArgumentError; rescue ArgumentError; 7; end").should == 7 |       eval("@y.z do raise ArgumentError; rescue ArgumentError; 7; end").should == 7 | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "taking || arguments" do |   describe "taking || arguments" do | ||||||
|     it "does not raise an exception when no values are yielded" do |     it "does not raise an exception when no values are yielded" do | ||||||
|  | @ -333,12 +331,10 @@ describe "A block" do | ||||||
|       @y.s(0) { || 1 }.should == 1 |       @y.s(0) { || 1 }.should == 1 | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "may include a rescue clause" do |     it "may include a rescue clause" do | ||||||
|       eval('@y.z do || raise ArgumentError; rescue ArgumentError; 7; end').should == 7 |       eval('@y.z do || raise ArgumentError; rescue ArgumentError; 7; end').should == 7 | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "taking |a| arguments" do |   describe "taking |a| arguments" do | ||||||
|     it "assigns nil to the argument when no values are yielded" do |     it "assigns nil to the argument when no values are yielded" do | ||||||
|  | @ -364,12 +360,10 @@ describe "A block" do | ||||||
|       @y.s([1, 2]) { |a| a }.should == [1, 2] |       @y.s([1, 2]) { |a| a }.should == [1, 2] | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "may include a rescue clause" do |     it "may include a rescue clause" do | ||||||
|       eval('@y.s(1) do |x| raise ArgumentError; rescue ArgumentError; 7; end').should == 7 |       eval('@y.s(1) do |x| raise ArgumentError; rescue ArgumentError; 7; end').should == 7 | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   describe "taking |a, b| arguments" do |   describe "taking |a, b| arguments" do | ||||||
|     it "assigns nil to the arguments when no values are yielded" do |     it "assigns nil to the arguments when no values are yielded" do | ||||||
|  |  | ||||||
|  | @ -425,20 +425,10 @@ end | ||||||
| 
 | 
 | ||||||
| describe "top-level constant lookup" do | describe "top-level constant lookup" do | ||||||
|   context "on a class" do |   context "on a class" do | ||||||
|     ruby_version_is "" ... "2.5" do |  | ||||||
|       it "searches Object successfully after searching other scopes" do |  | ||||||
|         -> { |  | ||||||
|           String::Hash.should == Hash |  | ||||||
|         }.should complain(/toplevel constant Hash referenced by/) |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     ruby_version_is "2.5" do |  | ||||||
|     it "does not search Object after searching other scopes" do |     it "does not search Object after searching other scopes" do | ||||||
|       -> { String::Hash }.should raise_error(NameError) |       -> { String::Hash }.should raise_error(NameError) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "searches Object unsuccessfully when searches on a module" do |   it "searches Object unsuccessfully when searches on a module" do | ||||||
|     -> { Enumerable::Hash }.should raise_error(NameError) |     -> { Enumerable::Hash }.should raise_error(NameError) | ||||||
|  |  | ||||||
|  | @ -756,17 +756,9 @@ describe "The defined? keyword for a scoped constant" do | ||||||
|     defined?(DefinedSpecs::String).should be_nil |     defined?(DefinedSpecs::String).should be_nil | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   ruby_version_is ""..."2.5" do |  | ||||||
|     it "returns 'constant' when a constant is defined on top-level but not on the class" do |  | ||||||
|       defined?(DefinedSpecs::Basic::String).should == 'constant' |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   ruby_version_is "2.5" do |  | ||||||
|   it "returns nil when a constant is defined on top-level but not on the class" do |   it "returns nil when a constant is defined on top-level but not on the class" do | ||||||
|     defined?(DefinedSpecs::Basic::String).should be_nil |     defined?(DefinedSpecs::Basic::String).should be_nil | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   it "returns 'constant' if the scoped-scoped constant is defined" do |   it "returns 'constant' if the scoped-scoped constant is defined" do | ||||||
|     defined?(DefinedSpecs::Child::A).should == "constant" |     defined?(DefinedSpecs::Child::A).should == "constant" | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nobuyoshi Nakada
						Nobuyoshi Nakada