From 844ca35a924ed2ff0de48f0e4680f05f8da234bf Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 1 Jul 2017 01:51:17 +0000 Subject: parse.y: mlhs_add_post * parse.y (mlhs_add_post): new parser event corresponding to POSTARG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ripper/test_parser_events.rb | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 94c55aa15e..c2d6a255be 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -474,19 +474,42 @@ class TestRipper::ParserEvents < Test::Unit::TestCase thru_mlhs_add_star = false tree = parse("a, *b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} assert_equal true, thru_mlhs_add_star - assert_include(tree, "massign([a,*b,[c]]", bug2232) + assert_include(tree, "massign([a,*b,c]", bug2232) thru_mlhs_add_star = false tree = parse("a, *, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} assert_equal true, thru_mlhs_add_star - assert_include(tree, "massign([a,*,[c]]", bug4364) + assert_include(tree, "massign([a,*,c]", bug4364) thru_mlhs_add_star = false tree = parse("*b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} assert_equal true, thru_mlhs_add_star - assert_include(tree, "massign([*b,[c]]", bug4364) + assert_include(tree, "massign([*b,c]", bug4364) thru_mlhs_add_star = false tree = parse("*, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} assert_equal true, thru_mlhs_add_star - assert_include(tree, "massign([*,[c]],", bug4364) + assert_include(tree, "massign([*,c],", bug4364) + end + + def test_mlhs_add_post + thru_mlhs_add_post = false + tree = parse("a, *b = 1, 2", :on_mlhs_add_post) {thru_mlhs_add_post = true} + assert_equal false, thru_mlhs_add_post + assert_include(tree, "massign([a,*b],") + thru_massign_add_post = false + tree = parse("a, *b, c = 1, 2", :on_mlhs_add_post) {thru_mlhs_add_post = true} + assert_equal true, thru_mlhs_add_post + assert_include(tree, "massign([a,*b,c],") + thru_mlhs_add_post = false + tree = parse("a, *, c = 1, 2", :on_mlhs_add_post) {thru_mlhs_add_post = true} + assert_equal true, thru_mlhs_add_post + assert_include(tree, "massign([a,*,c],") + thru_mlhs_add_post = false + tree = parse("*b, c = 1, 2", :on_mlhs_add_post) {thru_mlhs_add_post = true} + assert_equal true, thru_mlhs_add_post + assert_include(tree, "massign([*b,c],") + thru_mlhs_add_post = false + tree = parse("*, c = 1, 2", :on_mlhs_add_post) {thru_mlhs_add_post = true} + assert_equal true, thru_mlhs_add_post + assert_include(tree, "massign([*,c],") end def test_mlhs_new -- cgit v1.2.3