diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/kernel/shared | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/kernel/shared')
-rw-r--r-- | spec/ruby/core/kernel/shared/dup_clone.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/kind_of.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/lambda.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/load.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/method.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/require.rb | 32 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/sprintf.rb | 24 | ||||
-rw-r--r-- | spec/ruby/core/kernel/shared/sprintf_encoding.rb | 2 |
8 files changed, 40 insertions, 40 deletions
diff --git a/spec/ruby/core/kernel/shared/dup_clone.rb b/spec/ruby/core/kernel/shared/dup_clone.rb index 37890f2981..d1ee64bd09 100644 --- a/spec/ruby/core/kernel/shared/dup_clone.rb +++ b/spec/ruby/core/kernel/shared/dup_clone.rb @@ -102,12 +102,12 @@ describe :kernel_dup_clone, shared: true do ruby_version_is ''...'2.5' do it "raises a TypeError for Complex" do c = Complex(1.3, 3.1) - lambda { c.send(@method) }.should raise_error(TypeError) + -> { c.send(@method) }.should raise_error(TypeError) end it "raises a TypeError for Rational" do r = Rational(1, 3) - lambda { r.send(@method) }.should raise_error(TypeError) + -> { r.send(@method) }.should raise_error(TypeError) end end diff --git a/spec/ruby/core/kernel/shared/kind_of.rb b/spec/ruby/core/kernel/shared/kind_of.rb index 0614c02214..aef6f1c1d8 100644 --- a/spec/ruby/core/kernel/shared/kind_of.rb +++ b/spec/ruby/core/kernel/shared/kind_of.rb @@ -40,10 +40,10 @@ describe :kernel_kind_of, shared: true do end it "raises a TypeError if given an object that is not a Class nor a Module" do - lambda { @o.send(@method, 1) }.should raise_error(TypeError) - lambda { @o.send(@method, 'KindaClass') }.should raise_error(TypeError) - lambda { @o.send(@method, :KindaClass) }.should raise_error(TypeError) - lambda { @o.send(@method, Object.new) }.should raise_error(TypeError) + -> { @o.send(@method, 1) }.should raise_error(TypeError) + -> { @o.send(@method, 'KindaClass') }.should raise_error(TypeError) + -> { @o.send(@method, :KindaClass) }.should raise_error(TypeError) + -> { @o.send(@method, Object.new) }.should raise_error(TypeError) end it "does not take into account `class` method overriding" do diff --git a/spec/ruby/core/kernel/shared/lambda.rb b/spec/ruby/core/kernel/shared/lambda.rb index bebb111c43..c7180e1442 100644 --- a/spec/ruby/core/kernel/shared/lambda.rb +++ b/spec/ruby/core/kernel/shared/lambda.rb @@ -4,6 +4,6 @@ describe :kernel_lambda, shared: true do end it "raises an ArgumentError when no block is given" do - lambda { send(@method) }.should raise_error(ArgumentError) + -> { send(@method) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/core/kernel/shared/load.rb b/spec/ruby/core/kernel/shared/load.rb index b479b29399..14bf5f27da 100644 --- a/spec/ruby/core/kernel/shared/load.rb +++ b/spec/ruby/core/kernel/shared/load.rb @@ -81,7 +81,7 @@ describe :kernel_load, shared: true do it "raises a LoadError if passed a non-extensioned path that does not exist but a .rb extensioned path does exist" do path = File.expand_path "load_ext_fixture", CODE_LOADING_DIR - lambda { @object.load(path) }.should raise_error(LoadError) + -> { @object.load(path) }.should raise_error(LoadError) end describe "when passed true for 'wrap'" do @@ -115,7 +115,7 @@ describe :kernel_load, shared: true do end it "does not pollute the receiver" do - lambda { @object.send(:top_level_method) }.should raise_error(NameError) + -> { @object.send(:top_level_method) }.should raise_error(NameError) end end end diff --git a/spec/ruby/core/kernel/shared/method.rb b/spec/ruby/core/kernel/shared/method.rb index 006ebbffb8..3418966b1b 100644 --- a/spec/ruby/core/kernel/shared/method.rb +++ b/spec/ruby/core/kernel/shared/method.rb @@ -23,14 +23,14 @@ describe :kernel_method, shared: true do it "raises a NameError for an invalid method name" do class KernelSpecs::Foo; def bar; 'done'; end; end - lambda { + -> { KernelSpecs::Foo.new.send(@method, :invalid_and_silly_method_name) }.should raise_error(NameError) end it "raises a NameError for an invalid singleton method name" do class KernelSpecs::Foo; def self.bar; 'done'; end; end - lambda { KernelSpecs::Foo.send(@method, :baz) }.should raise_error(NameError) + -> { KernelSpecs::Foo.send(@method, :baz) }.should raise_error(NameError) end it "changes the method called for super on a target aliased method" do diff --git a/spec/ruby/core/kernel/shared/require.rb b/spec/ruby/core/kernel/shared/require.rb index 56377684fb..af0d50db4f 100644 --- a/spec/ruby/core/kernel/shared/require.rb +++ b/spec/ruby/core/kernel/shared/require.rb @@ -21,7 +21,7 @@ describe :kernel_require_basic, shared: true do it "raises a LoadError if the file does not exist" do path = File.expand_path "nonexistent.rb", CODE_LOADING_DIR File.exist?(path).should be_false - lambda { @object.send(@method, path) }.should raise_error(LoadError) + -> { @object.send(@method, path) }.should raise_error(LoadError) ScratchPad.recorded.should == [] end @@ -42,7 +42,7 @@ describe :kernel_require_basic, shared: true do it "raises a LoadError" do File.exist?(@path).should be_true - lambda { @object.send(@method, @path) }.should raise_error(LoadError) + -> { @object.send(@method, @path) }.should raise_error(LoadError) end end end @@ -57,19 +57,19 @@ describe :kernel_require_basic, shared: true do end it "raises a TypeError if passed nil" do - lambda { @object.send(@method, nil) }.should raise_error(TypeError) + -> { @object.send(@method, nil) }.should raise_error(TypeError) end it "raises a TypeError if passed a Fixnum" do - lambda { @object.send(@method, 42) }.should raise_error(TypeError) + -> { @object.send(@method, 42) }.should raise_error(TypeError) end it "raises a TypeError if passed an Array" do - lambda { @object.send(@method, []) }.should raise_error(TypeError) + -> { @object.send(@method, []) }.should raise_error(TypeError) end it "raises a TypeError if passed an object that does not provide #to_str" do - lambda { @object.send(@method, mock("not a filename")) }.should raise_error(TypeError) + -> { @object.send(@method, mock("not a filename")) }.should raise_error(TypeError) end it "raises a TypeError if passed an object that has #to_s but not #to_str" do @@ -77,14 +77,14 @@ describe :kernel_require_basic, shared: true do name.stub!(:to_s).and_return("load_fixture.rb") $LOAD_PATH << "." Dir.chdir CODE_LOADING_DIR do - lambda { @object.send(@method, name) }.should raise_error(TypeError) + -> { @object.send(@method, name) }.should raise_error(TypeError) end end it "raises a TypeError if #to_str does not return a String" do name = mock("#to_str returns nil") name.should_receive(:to_str).at_least(1).times.and_return(nil) - lambda { @object.send(@method, name) }.should raise_error(TypeError) + -> { @object.send(@method, name) }.should raise_error(TypeError) end it "calls #to_path on non-String objects" do @@ -170,7 +170,7 @@ describe :kernel_require_basic, shared: true do it "does not resolve a ./ relative path against $LOAD_PATH entries" do $LOAD_PATH << CODE_LOADING_DIR - lambda do + -> do @object.send(@method, "./load_fixture.rb") end.should raise_error(LoadError) ScratchPad.recorded.should == [] @@ -178,7 +178,7 @@ describe :kernel_require_basic, shared: true do it "does not resolve a ../ relative path against $LOAD_PATH entries" do $LOAD_PATH << CODE_LOADING_DIR - lambda do + -> do @object.send(@method, "../code/load_fixture.rb") end.should raise_error(LoadError) ScratchPad.recorded.should == [] @@ -208,14 +208,14 @@ describe :kernel_require, shared: true do # intentional for security reasons. it "does not load a bare filename unless the current working directory is in $LOAD_PATH" do Dir.chdir CODE_LOADING_DIR do - lambda { @object.require("load_fixture.rb") }.should raise_error(LoadError) + -> { @object.require("load_fixture.rb") }.should raise_error(LoadError) ScratchPad.recorded.should == [] end end it "does not load a relative path unless the current working directory is in $LOAD_PATH" do Dir.chdir File.dirname(CODE_LOADING_DIR) do - lambda do + -> do @object.require("code/load_fixture.rb") end.should raise_error(LoadError) ScratchPad.recorded.should == [] @@ -381,7 +381,7 @@ describe :kernel_require, shared: true do it "does not store the path if the load fails" do $LOAD_PATH << CODE_LOADING_DIR saved_loaded_features = $LOADED_FEATURES.dup - lambda { @object.require("raise_fixture.rb") }.should raise_error(RuntimeError) + -> { @object.require("raise_fixture.rb") }.should raise_error(RuntimeError) $LOADED_FEATURES.should == saved_loaded_features end @@ -683,7 +683,7 @@ describe :kernel_require, shared: true do Thread.current[:wait_for] = t2 Thread.current[:con_raise] = true - lambda { + -> { @object.require(@path) }.should raise_error(RuntimeError) @@ -724,7 +724,7 @@ describe :kernel_require, shared: true do t1 = Thread.new do Thread.current[:con_raise] = true - lambda { + -> { @object.require(@path) }.should raise_error(RuntimeError) @@ -764,7 +764,7 @@ describe :kernel_require, shared: true do it "stores the missing path in a LoadError object" do path = "abcd1234" - lambda { + -> { @object.send(@method, path) }.should raise_error(LoadError) { |e| e.path.should == path diff --git a/spec/ruby/core/kernel/shared/sprintf.rb b/spec/ruby/core/kernel/shared/sprintf.rb index 925c79e82b..9899684284 100644 --- a/spec/ruby/core/kernel/shared/sprintf.rb +++ b/spec/ruby/core/kernel/shared/sprintf.rb @@ -31,7 +31,7 @@ describe :kernel_sprintf, shared: true do end it "raises TypeError exception if cannot convert to Integer" do - -> () { + -> { format("%b", Object.new) }.should raise_error(TypeError) end @@ -120,7 +120,7 @@ describe :kernel_sprintf, shared: true do end it "raises TypeError exception if cannot convert to Float" do - -> () { + -> { format("%f", Object.new) }.should raise_error(TypeError) end @@ -296,13 +296,13 @@ describe :kernel_sprintf, shared: true do end it "raises ArgumentError if argument is a string of several characters" do - -> () { + -> { format("%c", "abc") }.should raise_error(ArgumentError) end it "raises ArgumentError if argument is an empty string" do - -> () { + -> { format("%c", "") }.should raise_error(ArgumentError) end @@ -338,7 +338,7 @@ describe :kernel_sprintf, shared: true do "abc" end - -> () { + -> { format("%s", obj) }.should raise_error(NoMethodError) end @@ -461,7 +461,7 @@ describe :kernel_sprintf, shared: true do end it "raises exception if argument number is bigger than actual arguments list" do - -> () { + -> { format("%4$d", 1, 2, 3) }.should raise_error(ArgumentError) end @@ -472,7 +472,7 @@ describe :kernel_sprintf, shared: true do end it "raises ArgumentError exception when absolute and relative argument numbers are mixed" do - -> () { + -> { format("%1$d %d", 1, 2) }.should raise_error(ArgumentError) end @@ -722,7 +722,7 @@ describe :kernel_sprintf, shared: true do end it "raises ArgumentError when is mixed with width" do - -> () { + -> { format("%*10d", 10, 112) }.should raise_error(ArgumentError) end @@ -821,7 +821,7 @@ describe :kernel_sprintf, shared: true do end it "cannot be mixed with unnamed style" do - -> () { + -> { format("%d %<foo>d", 1, foo: "123") }.should raise_error(ArgumentError) end @@ -841,13 +841,13 @@ describe :kernel_sprintf, shared: true do end it "cannot be mixed with unnamed style" do - -> () { + -> { format("%d %{foo}", 1, foo: "123") }.should raise_error(ArgumentError) end it "raises KeyError when there is no matching key" do - -> () { + -> { format("%{foo}", {}) }.should raise_error(KeyError) end @@ -870,7 +870,7 @@ describe :kernel_sprintf, shared: true do @base_method = @method end - it_behaves_like :key_error, -> (obj, key) { + it_behaves_like :key_error, -> obj, key { @base_method.call("%<#{key}>s", obj) }, { foooo: 1 } end diff --git a/spec/ruby/core/kernel/shared/sprintf_encoding.rb b/spec/ruby/core/kernel/shared/sprintf_encoding.rb index a92f3c10cd..c3d62bf3bb 100644 --- a/spec/ruby/core/kernel/shared/sprintf_encoding.rb +++ b/spec/ruby/core/kernel/shared/sprintf_encoding.rb @@ -21,7 +21,7 @@ describe :kernel_sprintf_encoding, shared: true do string = "Ä %s".encode('windows-1252') argument = "Ђ".encode('windows-1251') - -> () { + -> { format(string, argument) }.should raise_error(Encoding::CompatibilityError) end |