Skip to content

Commit

Permalink
Merge pull request ruby#68 from cwgem/dup-clone-special-const
Browse files Browse the repository at this point in the history
Adding specific on dup/clone for special constants raising type error.
  • Loading branch information
brixen committed Dec 1, 2011
2 parents 6fe040c + 10e55ec commit ab0a372
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/object/shared/dup_clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,24 @@ def initialize_copy(original)
o3.untrusted?.should == true
end
end

it "raises a TypeError for NilClass" do
lambda { nil.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for TrueClass" do
lambda { true.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for FalseClass" do
lambda { false.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for Fixnum" do
lambda { 1.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for Symbol" do
lambda { :my_symbol.send(@method) }.should raise_error(TypeError)
end
end

0 comments on commit ab0a372

Please sign in to comment.