summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-05-19 19:42:57 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-06-07 11:28:38 +0900
commit9e28354705e2aa312e5dee775e3bd08095fc7e9c (patch)
tree4f98dfa744da8c61f358bd9abb05bd34f297d9c7 /test
parent335cb28886dda81b5c3dad1bb02cf7b7450e05e9 (diff)
ripper: Fix excess `compile_error` at simple backref op_asgn
Fix up 89cfc1520717257073012ec07105c551e4b8af7c.
Diffstat (limited to 'test')
-rw-r--r--test/ripper/test_parser_events.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index a5c7401968..5434acb523 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -267,28 +267,28 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
end
def test_assign_error_backref
- thru_assign_error = false
+ errors = []
result =
- parse('$& = 1', :on_assign_error) {thru_assign_error = true}
- assert_equal true, thru_assign_error
+ parse('$& = 1', %i[on_assign_error compile_error]) {|e, *| errors << e}
+ assert_equal %i[on_assign_error], errors
assert_equal '[assign(assign_error(var_field($&)),1)]', result
- thru_assign_error = false
+ errors = []
result =
- parse('$&, _ = 1', :on_assign_error) {thru_assign_error = true}
- assert_equal true, thru_assign_error
+ parse('$&, _ = 1', %i[on_assign_error compile_error]) {|e, *| errors << e}
+ assert_equal %i[on_assign_error], errors
assert_equal '[massign([assign_error(var_field($&)),var_field(_)],1)]', result
- thru_assign_error = false
+ errors = []
result =
- parse('$& += 1', :on_assign_error) {thru_assign_error = true}
- assert_equal true, thru_assign_error
+ parse('$& += 1', %i[on_assign_error compile_error]) {|e, *| errors << e}
+ assert_equal %i[on_assign_error], errors
assert_equal '[assign_error(opassign(var_field($&),+=,1))]', result
- thru_assign_error = false
+ errors = []
result =
- parse('$& += cmd 1, 2', :on_assign_error) {thru_assign_error = true}
- assert_equal true, thru_assign_error
+ parse('$& += cmd 1, 2', %i[on_assign_error compile_error]) {|e, *| errors << e}
+ assert_equal %i[on_assign_error], errors
assert_equal '[assign_error(opassign(var_field($&),+=,command(cmd,[1,2])))]', result
end