Sha256: 8da9924978cc139339279d069a14f28d831ff4557097ba5153d9e73d03cacaf0
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facets/more/nilcomparable.rb # # Extracted Tue Jul 25 10:07:15 EDT 2006 # Unit Tools Reap Test Extractor # require 'facets/more/nilcomparable.rb' require 'test/unit' class Mock < String alias_method :compare_without_nil, :<=> def <=>( other ) return 1 if other.nil? compare_without_nil( other ) end end class TC_NilClass_Comparable < Test::Unit::TestCase def test001 assert_equal( 0, nil <=> nil ) assert_equal( -1, nil <=> 4 ) assert_equal( -1, nil <=> "a" ) assert_equal( -1, nil <=> Object.new ) assert_equal( 0, nil.cmp(nil) ) assert( nil < 4 ) end def test002 m = Mock.new("A") assert_equal( 1, m <=> nil ) assert_equal( -1, m <=> "B" ) #assert_equal( 1, m.cmp(nil) ) assert( m > nil ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facets-1.7.0 | test/lib/facets/more/test_nilcomparable.rb |