diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-06-24 19:53:14 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-06-24 19:53:14 +0900 |
commit | 263b941321c3de6afc8f9dafbc2625f866b7437e (patch) | |
tree | 7848e0ede150a7577b3ea3e9b10a3775b44885f3 /test/ripper/test_parser_events.rb | |
parent | 7f29e34f35d63f0eda0f9adec12d5ec766c1b1b1 (diff) | |
download | ruby-263b941321c3de6afc8f9dafbc2625f866b7437e.tar.gz |
[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/ripper/test_parser_events.rb')
-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 87bd0d4e0b..b7118fcbb2 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -1538,6 +1538,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} |