test/hexapdf/test_reference.rb in hexapdf-0.8.0 vs test/hexapdf/test_reference.rb in hexapdf-0.9.0
- old
+ new
@@ -1,9 +1,10 @@
# -*- encoding: utf-8 -*-
require 'test_helper'
require 'hexapdf/reference'
+require 'hexapdf/object'
describe HexaPDF::Reference do
it "correctly assigns oid and gen on initialization" do
r = HexaPDF::Reference.new(5, 7)
assert_equal(5, r.oid)
@@ -23,13 +24,14 @@
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
- it "is comparable to itself" do
+ it "is comparable to objects that have an oid and gen" do
assert_equal(HexaPDF::Reference.new(5, 7), HexaPDF::Reference.new(5, 7))
refute_equal(HexaPDF::Reference.new(5, 7), HexaPDF::Reference.new(5, 8))
refute_equal(HexaPDF::Reference.new(5, 7), HexaPDF::Reference.new(4, 7))
+ assert_equal(HexaPDF::Reference.new(5, 7), HexaPDF::Object.new(:data, oid: 5, gen: 7))
end
it "behaves correctly as hash key" do
h = {}
h[HexaPDF::Reference.new(5, 7)] = true