mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #279 from monaka/pr-test-for-comparable
Tests for Comparable. Still not all path coverage.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
|
||||
assert('<', '15.3.3.2.1') do
|
||||
class Foo
|
||||
include Comparable
|
||||
def <=>(x)
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
(Foo.new < Foo.new) == false
|
||||
end
|
||||
|
||||
assert('<=', '15.3.3.2.2') do
|
||||
class Foo
|
||||
include Comparable
|
||||
def <=>(x)
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
(Foo.new <= Foo.new) == true
|
||||
end
|
||||
|
||||
assert('==', '15.3.3.2.3') do
|
||||
class Foo
|
||||
include Comparable
|
||||
def <=>(x)
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
(Foo.new == Foo.new) == true
|
||||
end
|
||||
|
||||
assert('>', '15.3.3.2.4') do
|
||||
class Foo
|
||||
include Comparable
|
||||
def <=>(x)
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
(Foo.new > Foo.new) == false
|
||||
end
|
||||
|
||||
assert('>=', '15.3.3.2.5') do
|
||||
class Foo
|
||||
include Comparable
|
||||
def <=>(x)
|
||||
0
|
||||
end
|
||||
end
|
||||
|
||||
(Foo.new >= Foo.new) == true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user