summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-21 10:53:10 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-21 10:53:10 +0900
commite7f5cd7d4e21fe70aac62297c97e4ae70fad1e5f (patch)
tree32fc73abb5956ecfcac97f8256f90181b529f0b3 /test
parent4654db4fdc3c83c6feb7d6e49afa61d341a74af7 (diff)
parent367118b1b678b83869a9106191cb85197c9ef525 (diff)
downloadmruby-e7f5cd7d4e21fe70aac62297c97e4ae70fad1e5f.tar.gz
mruby-e7f5cd7d4e21fe70aac62297c97e4ae70fad1e5f.zip
Merge pull request #2097 from nobu/optional_arguments_in_rhs
fix optional arguments in rhs
Diffstat (limited to 'test')
-rw-r--r--test/t/syntax.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index 2adfbc8ab..245c5c099 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -272,3 +272,20 @@ assert('method definition in cmdarg') do
end
true
end
+
+assert('optional argument in the rhs default expressions') do
+ class OptArgInRHS
+ def foo
+ "method called"
+ end
+ def t(foo = foo)
+ foo
+ end
+ def t2(foo = foo())
+ foo
+ end
+ end
+ o = OptArgInRHS.new
+ assert_nil(o.t)
+ assert_equal("method called", o.t2)
+end