Permalink
Browse files

Additional Marshal specs (marshal_dump related)

  • Loading branch information...
Evan Phoenix
Evan Phoenix committed Feb 10, 2010
1 parent de932a4 commit fdf8c1316a6c28c02388155d4c2867c5ecb695f5
Showing with 21 additions and 0 deletions.
  1. +15 −0 spec/ruby/core/marshal/dump_spec.rb
  2. +6 −0 spec/ruby/core/marshal/fixtures/marshal_data.rb
@@ -201,6 +201,21 @@ def _dump(depth); 10; end
end
end
it "favors marshal_dump over _dump" do
m = mock("marshaled")
m.should_receive(:marshal_dump).and_return(0)
m.should_not_receive(:_dump)
Marshal.dump(m)
end
it "does not use Class#name when using marshal_dump" do
u = UserMarshalWithClassName.new
m = Marshal.dump(u)
m.index(u.class.name).should be_nil
end
ruby_version_is ""..."1.9" do
it "dumps an array containing the same objects" do
s = 'oh'; b = 'hi'; r = //; d = [b, :no, s, :go]; c = String
@@ -80,6 +80,12 @@ def marshal_load(data) @data = data end
def ==(other) self.class === other and @data == other.data end
end
class UserMarshalWithClassName < UserMarshal
def self.name
"Never::A::Real::Class"
end
end
class UserMarshalWithIvar
attr_reader :data

0 comments on commit fdf8c13

Please sign in to comment.