diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/syntax.rb | 17 |
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 |
