From 549a3b74c49537ec7b7e9cc82e17803ded1ca3da Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 12 Feb 2017 03:15:34 +0000 Subject: ripper: fix %-op on_operator_ambiguous * parse.y (ambiguous_operator): separate token and string representation of operators, to fix %-operator argument. in a warning message, needs to be escaped by '%' but the symbol should not be. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ripper/test_parser_events.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/ripper') diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 7af2019a09..7eac20a3ec 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -173,8 +173,14 @@ class TestRipper::ParserEvents < Test::Unit::TestCase def test_operator_ambiguous thru_operator_ambiguous = false - parse('a=1; a %[]', :on_operator_ambiguous) {thru_operator_ambiguous = true} + token = syntax = nil + parse('a=1; a %[]', :on_operator_ambiguous) {|*a| + thru_operator_ambiguous = true + _, token, syntax = *a + } assert_equal true, thru_operator_ambiguous + assert_equal :%, token + assert_equal "string literal", syntax end def test_array # array literal -- cgit v1.2.3