mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -9,7 +9,7 @@ describe "CApiNumericSpecs" do
|
|||
|
||||
describe "NUM2INT" do
|
||||
it "raises a TypeError if passed nil" do
|
||||
lambda { @s.NUM2INT(nil) }.should raise_error(TypeError)
|
||||
-> { @s.NUM2INT(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "converts a Float" do
|
||||
|
@ -33,7 +33,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 32bits" do
|
||||
lambda { @s.NUM2INT(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
-> { @s.NUM2INT(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
end
|
||||
|
||||
it "calls #to_int to coerce the value" do
|
||||
|
@ -45,7 +45,7 @@ describe "CApiNumericSpecs" do
|
|||
|
||||
describe "NUM2UINT" do
|
||||
it "raises a TypeError if passed nil" do
|
||||
lambda { @s.NUM2UINT(nil) }.should raise_error(TypeError)
|
||||
-> { @s.NUM2UINT(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "converts a Float" do
|
||||
|
@ -69,15 +69,15 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 32bits" do
|
||||
lambda { @s.NUM2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
-> { @s.NUM2UINT(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
end
|
||||
|
||||
it "raises a RangeError if the value is less than 32bits negative" do
|
||||
lambda { @s.NUM2UINT(-0x8000_0000-1) }.should raise_error(RangeError)
|
||||
-> { @s.NUM2UINT(-0x8000_0000-1) }.should raise_error(RangeError)
|
||||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 64bits" do
|
||||
lambda do
|
||||
-> do
|
||||
@s.NUM2UINT(0xffff_ffff_ffff_ffff+1)
|
||||
end.should raise_error(RangeError)
|
||||
end
|
||||
|
@ -91,7 +91,7 @@ describe "CApiNumericSpecs" do
|
|||
|
||||
describe "NUM2LONG" do
|
||||
it "raises a TypeError if passed nil" do
|
||||
lambda { @s.NUM2LONG(nil) }.should raise_error(TypeError)
|
||||
-> { @s.NUM2LONG(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "converts a Float" do
|
||||
|
@ -116,7 +116,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 32bits" do
|
||||
lambda { @s.NUM2LONG(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
-> { @s.NUM2LONG(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -130,7 +130,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 64bits" do
|
||||
lambda do
|
||||
-> do
|
||||
@s.NUM2LONG(0xffff_ffff_ffff_ffff+1)
|
||||
end.should raise_error(RangeError)
|
||||
end
|
||||
|
@ -145,7 +145,7 @@ describe "CApiNumericSpecs" do
|
|||
|
||||
describe "INT2NUM" do
|
||||
it "raises a TypeError if passed nil" do
|
||||
lambda { @s.INT2NUM(nil) }.should raise_error(TypeError)
|
||||
-> { @s.INT2NUM(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "converts a Float" do
|
||||
|
@ -153,7 +153,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError when passed a Bignum" do
|
||||
lambda { @s.INT2NUM(bignum_value) }.should raise_error(RangeError)
|
||||
-> { @s.INT2NUM(bignum_value) }.should raise_error(RangeError)
|
||||
end
|
||||
|
||||
it "converts a Fixnum" do
|
||||
|
@ -167,7 +167,7 @@ describe "CApiNumericSpecs" do
|
|||
|
||||
describe "NUM2ULONG" do
|
||||
it "raises a TypeError if passed nil" do
|
||||
lambda { @s.NUM2ULONG(nil) }.should raise_error(TypeError)
|
||||
-> { @s.NUM2ULONG(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "converts a Float" do
|
||||
|
@ -199,7 +199,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 32bits" do
|
||||
lambda { @s.NUM2ULONG(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
-> { @s.NUM2ULONG(0xffff_ffff+1) }.should raise_error(RangeError)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -220,7 +220,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a RangeError if the value is more than 64bits" do
|
||||
lambda do
|
||||
-> do
|
||||
@s.NUM2ULONG(0xffff_ffff_ffff_ffff+1)
|
||||
end.should raise_error(RangeError)
|
||||
end
|
||||
|
@ -287,11 +287,11 @@ describe "CApiNumericSpecs" do
|
|||
|
||||
describe "NUM2DBL" do
|
||||
it "raises a TypeError if passed nil" do
|
||||
lambda { @s.NUM2DBL(nil) }.should raise_error(TypeError)
|
||||
-> { @s.NUM2DBL(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "raises a TypeError if passed a String" do
|
||||
lambda { @s.NUM2DBL("1.2") }.should raise_error(TypeError)
|
||||
-> { @s.NUM2DBL("1.2") }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "converts a Float" do
|
||||
|
@ -327,13 +327,13 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises a TypeError when passed an empty String" do
|
||||
lambda { @s.NUM2CHR("") }.should raise_error(TypeError)
|
||||
-> { @s.NUM2CHR("") }.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
describe "rb_num_zerodiv" do
|
||||
it "raises a RuntimeError" do
|
||||
lambda { @s.rb_num_zerodiv() }.should raise_error(ZeroDivisionError, 'divided by 0')
|
||||
-> { @s.rb_num_zerodiv() }.should raise_error(ZeroDivisionError, 'divided by 0')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -363,7 +363,7 @@ describe "CApiNumericSpecs" do
|
|||
end
|
||||
|
||||
it "raises an ArgumentError when passed nil" do
|
||||
lambda {
|
||||
-> {
|
||||
@s.rb_cmpint(nil, 4)
|
||||
}.should raise_error(ArgumentError)
|
||||
end
|
||||
|
@ -389,7 +389,7 @@ describe "CApiNumericSpecs" do
|
|||
obj = mock("rb_num_coerce_bin")
|
||||
obj.should_receive(:coerce).with(2).and_return(nil)
|
||||
|
||||
lambda { @s.rb_num_coerce_bin(2, obj, :+) }.should raise_error(TypeError)
|
||||
-> { @s.rb_num_coerce_bin(2, obj, :+) }.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -457,14 +457,14 @@ describe "CApiNumericSpecs" do
|
|||
obj.should_receive(:coerce).with(2).and_return([obj, 2])
|
||||
obj.should_receive(:<).with(2).and_return(nil)
|
||||
|
||||
lambda { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
|
||||
-> { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it "raises an ArgumentError if #coerce does not return an Array" do
|
||||
obj = mock("rb_num_coerce_relop")
|
||||
obj.should_receive(:coerce).with(2).and_return(nil)
|
||||
|
||||
lambda { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
|
||||
-> { @s.rb_num_coerce_relop(2, obj, :<) }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue