diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-02 17:48:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-02 17:48:10 +0000 |
commit | 371a6d86fcea05787fdae5b0ecace88266f0300e (patch) | |
tree | afb8bb9190c704f5b4634eca516bd24b7273de17 /test | |
parent | c4121dd62cf1fadde9687c2807de5b125f2157db (diff) | |
download | ruby-371a6d86fcea05787fdae5b0ecace88266f0300e.tar.gz |
ripper/lexer.rb: nested indented heredoc
* ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): fix for
nested indedented here documents, where `Elem`s are nested too.
[ruby-core:80977] [Bug #13536]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ripper/test_lexer.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb new file mode 100644 index 0000000000..2ec66cd592 --- /dev/null +++ b/test/ripper/test_lexer.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +begin + require_relative 'dummyparser' + require 'test/unit' + ripper_test = true + module TestRipper; end +rescue LoadError +end + +class TestRipper::Lexer < Test::Unit::TestCase + def test_nested_dedent_heredoc + bug = '[ruby-core:80977] [Bug #13536]' + str = <<~'E' + <<~"D" + #{ + <<~"B" + this must be a valid ruby + B + } + D + E + assert_equal(str, Ripper.tokenize(str).join(""), bug) + end +end |