test/hexapdf/test_reference.rb in hexapdf-0.7.0 vs test/hexapdf/test_reference.rb in hexapdf-0.8.0
- old
+ new
@@ -17,9 +17,10 @@
it "is sortable w.r.t to other objects implementing #oid and #gen" do
obj = Object.new
obj.define_singleton_method(:oid) { 1 }
obj.define_singleton_method(:gen) { 0 }
+ obj.define_singleton_method(:<=>) {|o| HexaPDF::Reference.new(oid, gen) <=> o }
assert_equal([obj, HexaPDF::Reference.new(1, 1), HexaPDF::Reference.new(5, 7)],
[HexaPDF::Reference.new(5, 7), HexaPDF::Reference.new(1, 1), obj].sort)
assert_nil(HexaPDF::Reference.new(1, 0) <=> 5)
end