Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d734f22bf5
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (30 sloc) 0.964 kb
#
# ActiveFacts tests: Roles of object_type classes in the Runtime API
# Copyright (c) 2008 Clifford Heath. Read the LICENSE file.
#
include ActiveFacts::API
describe ComparableHashKey do
it "should be negative for ['a'] <=> ['b']" do
vt1 = ComparableHashKey.new(['a'])
vt2 = ComparableHashKey.new(['b'])
vt1.<=>(vt2).should == -1
end
it "should be equal for ['a'] <=> ['a']" do
vt1 = ComparableHashKey.new(['a'])
vt2 = ComparableHashKey.new(['a'])
vt1.<=>(vt2).should == 0
end
it "should be negative for ['b'] <=> ['a']" do
vt1 = ComparableHashKey.new(['b'])
vt2 = ComparableHashKey.new(['a'])
vt1.<=>(vt2).should == 1
end
it "should fall back on string comparison with nil values" do
vt1 = ComparableHashKey.new([nil])
vt2 = ComparableHashKey.new(['a'])
vt1.<=>(vt2).should == 1
vt1 = ComparableHashKey.new([nil])
vt2 = ComparableHashKey.new([1])
vt1.<=>(vt2).should == 1
end
end
Jump to Line
Something went wrong with that request. Please try again.