mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/ruby/test_pattern_matching.rb: add missing tests for NODE_DASGN, NODE_LASGN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2dc51bf447
commit
710e763e72
1 changed files with 18 additions and 0 deletions
|
@ -193,6 +193,7 @@ class TestPatternMatching < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_var_pattern
|
||||
# NODE_DASGN_CURR
|
||||
assert_block do
|
||||
case [0, 1]
|
||||
in a, a
|
||||
|
@ -200,6 +201,23 @@ class TestPatternMatching < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
# NODE_DASGN
|
||||
b = 0
|
||||
assert_block do
|
||||
case [0, 1]
|
||||
in b, b
|
||||
b == 1
|
||||
end
|
||||
end
|
||||
|
||||
# NODE_LASGN
|
||||
case [0, 1]
|
||||
in c, c
|
||||
assert_equal(1, c)
|
||||
else
|
||||
flunk
|
||||
end
|
||||
|
||||
assert_syntax_error(%q{
|
||||
case 0
|
||||
in ^a
|
||||
|
|
Loading…
Reference in a new issue