summaryrefslogtreecommitdiffhomepage
path: root/test/t/syntax.rb
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-12 12:16:18 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-12 12:16:18 +0900
commit46b098e0799f67915e4deb3bf7bdfb6d4d4bcf2d (patch)
treeb9a1a6d1fc58cdd8f737ad3c59b38452b61cec5e /test/t/syntax.rb
parent3403f19cb55b8474abc213d52293ff1b69d2a455 (diff)
downloadmruby-46b098e0799f67915e4deb3bf7bdfb6d4d4bcf2d.tar.gz
mruby-46b098e0799f67915e4deb3bf7bdfb6d4d4bcf2d.zip
minor correction in test/t/syntax.rb
Diffstat (limited to 'test/t/syntax.rb')
-rw-r--r--test/t/syntax.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
new file mode 100644
index 000000000..7898a0b7d
--- /dev/null
+++ b/test/t/syntax.rb
@@ -0,0 +1,47 @@
+assert('super', '11.3.4') do
+ test = false
+ begin
+ super
+ rescue NoMethodError
+ test = true
+ end
+
+ class SuperFoo
+ def foo
+ true
+ end
+ def bar(*a)
+ a
+ end
+ end
+ class SuperBar < SuperFoo
+ def foo
+ super
+ end
+ def bar(*a)
+ super(*a)
+ end
+ end
+ bar = SuperBar.new
+ test &&= bar.foo
+ test &&= (bar.bar(1,2,3) == [1,2,3])
+ test
+end
+
+assert('yield', '11.3.5') do
+ begin
+ yield
+ rescue LocalJumpError
+ true
+ else
+ false
+ end
+end
+
+assert('Abbreviated variable assignment', '11.4.2.3.2') do
+ a ||= 1
+ b &&= 1
+ c = 1
+ c += 2
+ a == 1 and b == nil and c == 3
+end