summaryrefslogtreecommitdiff
path: root/test/ripper
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-02-01 23:07:02 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-02-01 23:07:02 +0900
commit17986daf6edd00313c2a2fe4d2dfccb4f1472977 (patch)
treee4f5c042f309defd11f98a4e11b0830584fcc5aa /test/ripper
parent138f0ba6da2a1ecf80729be3065310c5c0cfdb9a (diff)
merge revision(s) b84b253a69537a14e4854e17b6d94ae75c2af050: [Backport #17547]
Fix Ripper with heredoc. --- ext/ripper/lib/ripper/lexer.rb | 1 + test/ripper/test_lexer.rb | 10 ++++++++++ 2 files changed, 11 insertions(+)
Diffstat (limited to 'test/ripper')
-rw-r--r--test/ripper/test_lexer.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb
index f8e751da53..3eaeb8fefa 100644
--- a/test/ripper/test_lexer.rb
+++ b/test/ripper/test_lexer.rb
@@ -90,6 +90,16 @@ class TestRipper::Lexer < Test::Unit::TestCase
assert_equal expect, Ripper.lex(src).map {|e| e[1]}
end
+ def test_stack_at_on_heredoc_beg
+ src = "a <<b"
+ expect = %I[
+ on_ident
+ on_sp
+ on_heredoc_beg
+ ]
+ assert_equal expect, Ripper.lex(src).map {|e| e[1]}
+ end
+
def test_slice
assert_equal "string\#{nil}\n",
Ripper.slice(%(<<HERE\nstring\#{nil}\nHERE), "heredoc_beg .*? nl $(.*?) heredoc_end", 1)