summaryrefslogtreecommitdiff
path: root/test/ripper/test_parser_events.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ripper/test_parser_events.rb')
-rw-r--r--test/ripper/test_parser_events.rb25
1 files changed, 22 insertions, 3 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index c9b5690245..537d3fc406 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -183,29 +183,48 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
end
def test_assign_error
+ # for test_coverage
+ end
+
+ def test_assign_error_backref
thru_assign_error = false
parse('$` = 1', :on_assign_error) {thru_assign_error = true}
assert_equal true, thru_assign_error
thru_assign_error = false
parse('$`, _ = 1', :on_assign_error) {thru_assign_error = true}
assert_equal true, thru_assign_error
+ end
+ def test_assign_error_const_qualified
thru_assign_error = false
parse('self::X = 1', :on_assign_error) {thru_assign_error = true}
assert_equal false, thru_assign_error
- parse('def m\n self::X = 1\nend', :on_assign_error) {thru_assign_error = true}
+ parse("def m\n self::X = 1\nend", :on_assign_error) {thru_assign_error = true}
assert_equal true, thru_assign_error
+ thru_assign_error = false
+ parse("def m\n self::X, a = 1, 2\nend", :on_assign_error) {thru_assign_error = true}
+ assert_equal true, thru_assign_error
+ end
+ def test_assign_error_const
thru_assign_error = false
parse('X = 1', :on_assign_error) {thru_assign_error = true}
assert_equal false, thru_assign_error
- parse('def m\n X = 1\nend', :on_assign_error) {thru_assign_error = true}
+ parse("def m\n X = 1\nend", :on_assign_error) {thru_assign_error = true}
assert_equal true, thru_assign_error
+ thru_assign_error = false
+ parse("def m\n X, a = 1, 2\nend", :on_assign_error) {thru_assign_error = true}
+ assert_equal true, thru_assign_error
+ end
+ def test_assign_error_const_toplevel
thru_assign_error = false
parse('::X = 1', :on_assign_error) {thru_assign_error = true}
assert_equal false, thru_assign_error
- parse('def m\n ::X = 1\nend', :on_assign_error) {thru_assign_error = true}
+ parse("def m\n ::X = 1\nend", :on_assign_error) {thru_assign_error = true}
+ assert_equal true, thru_assign_error
+ thru_assign_error = false
+ parse("def m\n ::X, a = 1, 2\nend", :on_assign_error) {thru_assign_error = true}
assert_equal true, thru_assign_error
end