diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-14 06:59:37 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-14 06:59:37 -0700 |
| commit | d11872487287b7f0100bdba96c64a3f5301f43f4 (patch) | |
| tree | f18813e59b184da702c4d2f36a60c034804611f0 | |
| parent | 268a1fd289f3630cc49d0c6bf68cb4d33243e24d (diff) | |
| parent | 587e0b0137234ee4d8b18430d41f7cf07569a732 (diff) | |
| download | mruby-d11872487287b7f0100bdba96c64a3f5301f43f4.tar.gz mruby-d11872487287b7f0100bdba96c64a3f5301f43f4.zip | |
Merge pull request #279 from monaka/pr-test-for-comparable
Tests for Comparable. Still not all path coverage.
| -rw-r--r-- | test/t/comparable.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/t/comparable.rb b/test/t/comparable.rb new file mode 100644 index 000000000..f3c03a9b5 --- /dev/null +++ b/test/t/comparable.rb @@ -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 + |
