diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-29 16:08:16 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-29 16:08:16 +0000 |
commit | 3fa5bd38af50fb3d98de0ea51043d73f8d06a24b (patch) | |
tree | d473b71cc6925ee1e17727215e9f9a66e3f24802 /spec/ruby/core/kernel | |
parent | 1e658d45e1f8dbadab18f9c35b5cfb5a5fec98bf (diff) | |
download | ruby-3fa5bd38af50fb3d98de0ea51043d73f8d06a24b.tar.gz |
Update to ruby/spec@83063a3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/kernel')
-rw-r--r-- | spec/ruby/core/kernel/Hash_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/kernel/is_a_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/kind_of_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/lambda_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/method_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/proc_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/public_method_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/public_send_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/send_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/sprintf.rb | 18 | ||||
-rw-r--r-- | spec/ruby/core/kernel/system_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/core/kernel/yield_self_spec.rb | 4 |
12 files changed, 35 insertions, 23 deletions
diff --git a/spec/ruby/core/kernel/Hash_spec.rb b/spec/ruby/core/kernel/Hash_spec.rb index 8d51316c75..049987758e 100644 --- a/spec/ruby/core/kernel/Hash_spec.rb +++ b/spec/ruby/core/kernel/Hash_spec.rb @@ -2,7 +2,13 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) describe "Kernel#hash" do - it "needs to be reviewed for spec completeness" + it "is provided" do + 1.respond_to?(:hash).should == true + end + + it "is stable" do + 1.hash.should == 1.hash + end end describe "Kernel" do diff --git a/spec/ruby/core/kernel/is_a_spec.rb b/spec/ruby/core/kernel/is_a_spec.rb index c67c6552a0..529de300e1 100644 --- a/spec/ruby/core/kernel/is_a_spec.rb +++ b/spec/ruby/core/kernel/is_a_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/kind_of', __FILE__) describe "Kernel#is_a?" do - it_behaves_like(:kernel_kind_of , :is_a?) + it_behaves_like :kernel_kind_of , :is_a? end diff --git a/spec/ruby/core/kernel/kind_of_spec.rb b/spec/ruby/core/kernel/kind_of_spec.rb index 56a54ec859..820245e0ee 100644 --- a/spec/ruby/core/kernel/kind_of_spec.rb +++ b/spec/ruby/core/kernel/kind_of_spec.rb @@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/kind_of', __FILE__) describe "Kernel#kind_of?" do - it_behaves_like(:kernel_kind_of , :kind_of?) + it_behaves_like :kernel_kind_of , :kind_of? end diff --git a/spec/ruby/core/kernel/lambda_spec.rb b/spec/ruby/core/kernel/lambda_spec.rb index 8fa0075675..d959539757 100644 --- a/spec/ruby/core/kernel/lambda_spec.rb +++ b/spec/ruby/core/kernel/lambda_spec.rb @@ -5,7 +5,7 @@ require File.expand_path('../shared/lambda', __FILE__) # The functionality of lambdas is specified in core/proc describe "Kernel.lambda" do - it_behaves_like(:kernel_lambda, :lambda) + it_behaves_like :kernel_lambda, :lambda it "is a private method" do Kernel.should have_private_instance_method(:lambda) diff --git a/spec/ruby/core/kernel/method_spec.rb b/spec/ruby/core/kernel/method_spec.rb index 09a3f940ca..89ef026ac3 100644 --- a/spec/ruby/core/kernel/method_spec.rb +++ b/spec/ruby/core/kernel/method_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../shared/method', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) describe "Kernel#method" do - it_behaves_like(:kernel_method, :method) + it_behaves_like :kernel_method, :method before :each do @obj = KernelSpecs::A.new diff --git a/spec/ruby/core/kernel/proc_spec.rb b/spec/ruby/core/kernel/proc_spec.rb index 4e4854f97d..f60dcfedb6 100644 --- a/spec/ruby/core/kernel/proc_spec.rb +++ b/spec/ruby/core/kernel/proc_spec.rb @@ -22,7 +22,7 @@ describe "Kernel.proc" do l.lambda?.should be_true end - it_behaves_like(:kernel_lambda, :proc) + it_behaves_like :kernel_lambda, :proc it "returns from the creation site of the proc, not just the proc itself" do @reached_end_of_method = nil diff --git a/spec/ruby/core/kernel/public_method_spec.rb b/spec/ruby/core/kernel/public_method_spec.rb index f1cc168420..eabc6ab22e 100644 --- a/spec/ruby/core/kernel/public_method_spec.rb +++ b/spec/ruby/core/kernel/public_method_spec.rb @@ -3,7 +3,7 @@ require File.expand_path('../fixtures/classes', __FILE__) require File.expand_path('../shared/method', __FILE__) describe "Kernel#public_method" do - it_behaves_like(:kernel_method, :public_method) + it_behaves_like :kernel_method, :public_method before :each do @obj = KernelSpecs::A.new diff --git a/spec/ruby/core/kernel/public_send_spec.rb b/spec/ruby/core/kernel/public_send_spec.rb index 2eabbc7dc9..346673d8a4 100644 --- a/spec/ruby/core/kernel/public_send_spec.rb +++ b/spec/ruby/core/kernel/public_send_spec.rb @@ -104,5 +104,5 @@ describe "Kernel#public_send" do }.should raise_error(NoMethodError) end - it_behaves_like(:basicobject_send, :public_send) + it_behaves_like :basicobject_send, :public_send end diff --git a/spec/ruby/core/kernel/send_spec.rb b/spec/ruby/core/kernel/send_spec.rb index 8afd16e97c..e7eed6b265 100644 --- a/spec/ruby/core/kernel/send_spec.rb +++ b/spec/ruby/core/kernel/send_spec.rb @@ -64,5 +64,5 @@ describe "Kernel#send" do KernelSpecs::Foo.new.send(:aka).should == 'done2' end - it_behaves_like(:basicobject_send, :send) + it_behaves_like :basicobject_send, :send end diff --git a/spec/ruby/core/kernel/shared/sprintf.rb b/spec/ruby/core/kernel/shared/sprintf.rb index e595a06640..9935d27db9 100644 --- a/spec/ruby/core/kernel/shared/sprintf.rb +++ b/spec/ruby/core/kernel/shared/sprintf.rb @@ -1,3 +1,5 @@ +require File.expand_path('../../../../shared/hash/key_error', __FILE__) + describe :kernel_sprintf, shared: true do def format(*args) @method.call(*args) @@ -823,12 +825,6 @@ describe :kernel_sprintf, shared: true do format("%d %<foo>d", 1, foo: "123") }.should raise_error(ArgumentError) end - - it "raises KeyError when there is no matching key" do - -> () { - format("%<foo>s", {}) - }.should raise_error(KeyError) - end end describe "%{name} style" do @@ -868,4 +864,14 @@ describe :kernel_sprintf, shared: true do end end end + + describe "faulty key" do + before :all do + @base_method = @method + end + + it_behaves_like :key_error, -> (obj, key) { + @base_method.call("%<#{key}>s", obj) + }, { foooo: 1 } + end end diff --git a/spec/ruby/core/kernel/system_spec.rb b/spec/ruby/core/kernel/system_spec.rb index a3dfbeba05..c6bc4416e7 100644 --- a/spec/ruby/core/kernel/system_spec.rb +++ b/spec/ruby/core/kernel/system_spec.rb @@ -25,12 +25,14 @@ describe :kernel_system, shared: true do $?.exitstatus.should == 1 end - it "raises RuntimeError when `exception: true` is given and the command exits with a non-zero exit status" do - lambda { @object.system(ruby_cmd('exit 1'), exception: true) }.should raise_error(RuntimeError) - end + ruby_version_is "2.6" do + it "raises RuntimeError when `exception: true` is given and the command exits with a non-zero exit status" do + lambda { @object.system(ruby_cmd('exit 1'), exception: true) }.should raise_error(RuntimeError) + end - it "raises Errno::ENOENT when `exception: true` is given and the specified command does not exist" do - lambda { @object.system('feature_14386', exception: true) }.should raise_error(Errno::ENOENT) + it "raises Errno::ENOENT when `exception: true` is given and the specified command does not exist" do + lambda { @object.system('feature_14386', exception: true) }.should raise_error(Errno::ENOENT) + end end it "returns nil when command execution fails" do diff --git a/spec/ruby/core/kernel/yield_self_spec.rb b/spec/ruby/core/kernel/yield_self_spec.rb index 817c01f288..9c81be463d 100644 --- a/spec/ruby/core/kernel/yield_self_spec.rb +++ b/spec/ruby/core/kernel/yield_self_spec.rb @@ -1,8 +1,6 @@ require File.expand_path('../../../spec_helper', __FILE__) -has_yield_self = VersionGuard.new("2.5").match? || PlatformGuard.implementation?(:truffleruby) - -if has_yield_self +ruby_version_is "2.5" do describe "Kernel#yield_self" do it "yields self" do object = Object.new |