aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-06-27 12:20:36 +0900
committernagachika <nagachika@ruby-lang.org>2020-06-27 12:20:36 +0900
commitd8a32b146561a0ddd3e60da9863a082b7e7725db (patch)
tree696746bd7d753b1d644b464ecf1c27a399a265fc /test
parent3c55d93cf68b1a969b90b306de4dd8b88d74a2f2 (diff)
downloadruby-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.rb6
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}