summaryrefslogtreecommitdiffhomepage
path: root/test/t/comparable.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-04-10 01:43:00 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2013-04-10 01:43:00 +0900
commitac005ea9391015dc049cc0b9061e879007786ac7 (patch)
treee69a8206c43cafe99f0795368dd3321a5bb873b0 /test/t/comparable.rb
parent84acf4e3f38d01c72ae077db1234c880658c10aa (diff)
parent87cd4c5ecc69208018c4d9deea63d566974561dd (diff)
downloadmruby-ac005ea9391015dc049cc0b9061e879007786ac7.tar.gz
mruby-ac005ea9391015dc049cc0b9061e879007786ac7.zip
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'test/t/comparable.rb')
-rw-r--r--test/t/comparable.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/t/comparable.rb b/test/t/comparable.rb
index c95134246..ab81fa3ed 100644
--- a/test/t/comparable.rb
+++ b/test/t/comparable.rb
@@ -54,3 +54,18 @@ assert('Comparable#>=', '15.3.3.2.5') do
(Foo.new >= Foo.new) == true
end
+assert('Comparable#between?', '15.3.3.2.6') do
+ class Foo
+ include Comparable
+ def <=>(x)
+ x
+ end
+ end
+
+ c = Foo.new
+ c.between?(-1, 1) == false &&
+ c.between?(-1, -1) == false &&
+ c.between?( 1, 1) == false &&
+ c.between?( 1, -1) == true &&
+ c.between?(0, 0) == true
+end