diff options
author | nagachika <nagachika@ruby-lang.org> | 2020-06-27 12:20:36 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2020-06-27 12:20:36 +0900 |
commit | d8a32b146561a0ddd3e60da9863a082b7e7725db (patch) | |
tree | 696746bd7d753b1d644b464ecf1c27a399a265fc /test | |
parent | 3c55d93cf68b1a969b90b306de4dd8b88d74a2f2 (diff) | |
download | ruby-d8a32b146561a0ddd3e60da9863a082b7e7725db.tar.gz |
merge revision(s) 263b941321c3de6afc8f9dafbc2625f866b7437e: [Backport #16981]
[ripper] fix mismatched indentations warning [Bug #16981]
The scanner location has to be set from `lex.ptok` before it is
flushed by dispatching the scanner event.
Diffstat (limited to 'test')
-rw-r--r-- | test/ripper/test_parser_events.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index feb3db05d8..80d455d7d5 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -1535,6 +1535,12 @@ class TestRipper::ParserEvents < Test::Unit::TestCase assert_match(/encountered/, fmt) end + def test_warn_mismatched_indentations + fmt, tokend, tokbeg, line = assert_warning("") {break warn("if true\n end\n")} + assert_match(/mismatched indentations/, fmt) + assert_equal(["if", "end", 1], [tokbeg, tokend, line]) + end + def test_in thru_in = false parse('case 0; in 0; end', :on_in) {thru_in = true} |