diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-29 14:35:37 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-29 14:35:37 +0000 |
commit | 5b593e388931490c1e2246d0347c892440167b2c (patch) | |
tree | 70d928d35c01b51bb9a6cdc44af4bd7cc05a669b /spec/rubyspec/core/fixnum | |
parent | 6a4aa4838cc53a520044b86deb4ecddb57bca876 (diff) |
Update to ruby/spec@abf1700
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/core/fixnum')
-rw-r--r-- | spec/rubyspec/core/fixnum/bit_and_spec.rb | 6 | ||||
-rw-r--r-- | spec/rubyspec/core/fixnum/fixnum_spec.rb | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/rubyspec/core/fixnum/bit_and_spec.rb b/spec/rubyspec/core/fixnum/bit_and_spec.rb index ff0e597a52..9586075039 100644 --- a/spec/rubyspec/core/fixnum/bit_and_spec.rb +++ b/spec/rubyspec/core/fixnum/bit_and_spec.rb @@ -27,6 +27,12 @@ describe "Fixnum#&" do (-1 & 2**64).should == 18446744073709551616 end + it "coerces the rhs and calls #coerce" do + obj = mock("fixnum bit and") + obj.should_receive(:coerce).with(6).and_return([3, 6]) + (6 & obj).should == 2 + end + it "raises a TypeError when passed a Float" do lambda { (3 & 3.4) }.should raise_error(TypeError) end diff --git a/spec/rubyspec/core/fixnum/fixnum_spec.rb b/spec/rubyspec/core/fixnum/fixnum_spec.rb index d0af975c59..8a050fd25e 100644 --- a/spec/rubyspec/core/fixnum/fixnum_spec.rb +++ b/spec/rubyspec/core/fixnum/fixnum_spec.rb @@ -4,4 +4,16 @@ describe "Fixnum" do it "includes Comparable" do Fixnum.include?(Comparable).should == true end + + it ".allocate raises a TypeError" do + lambda do + Fixnum.allocate + end.should raise_error(TypeError) + end + + it ".new is undefined" do + lambda do + Fixnum.new + end.should raise_error(NoMethodError) + end end |