aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_ifunless.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_ifunless.rb')
-rw-r--r--test/ruby/test_ifunless.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_ifunless.rb b/test/ruby/test_ifunless.rb
new file mode 100644
index 0000000000..7910f81b52
--- /dev/null
+++ b/test/ruby/test_ifunless.rb
@@ -0,0 +1,16 @@
+require 'test/unit'
+
+$KCODE = 'none'
+
+class TestIfunless < Test::Unit::TestCase
+ def test_if_unless
+ $x = 'test';
+ assert(if $x == $x then true else false end)
+ $bad = false
+ unless $x == $x
+ $bad = true
+ end
+ assert(!$bad)
+ assert(unless $x != $x then true else false end)
+ end
+end