summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2022-12-27 16:43:40 +0000
committergit <svn-admin@ruby-lang.org>2022-12-27 16:43:44 +0000
commit140c93e2dcdccc640a3be3ad6b5f7a7696587dbc (patch)
tree7065d31f967afeaeaf69cb717c83336094186b4a /test/irb
parentdb19714b17e365d11ceb13e0d16c8cf3c837f38c (diff)
downloadruby-140c93e2dcdccc640a3be3ad6b5f7a7696587dbc.tar.gz
[ruby/irb] Add dynamic prompt test case for quoted heredoc
(https://github.com/ruby/irb/pull/486) https://github.com/ruby/irb/commit/31cfbeacbb
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_ruby_lex.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb
index 7802ffb4a6..3caa036ce5 100644
--- a/test/irb/test_ruby_lex.rb
+++ b/test/irb/test_ruby_lex.rb
@@ -212,6 +212,24 @@ module TestIRB
assert_dynamic_prompt(lines, expected_prompt_list)
end
+ def test_heredoc_prompt_with_quotes
+ input_with_prompt = [
+ PromptRow.new("001:0:':* ", %q(<<~'A')),
+ PromptRow.new("002:0:':* ", %q(#{foobar})),
+ PromptRow.new("003:0: :> ", %q(A)),
+ PromptRow.new("004:0:`:* ", %q(<<~`A`)),
+ PromptRow.new("005:0:`:* ", %q(whoami)),
+ PromptRow.new("006:0: :> ", %q(A)),
+ PromptRow.new('007:0:":* ', %q(<<~"A")),
+ PromptRow.new('008:0:":* ', %q(foobar)),
+ PromptRow.new('009:0: :> ', %q(A)),
+ ]
+
+ lines = input_with_prompt.map(&:content)
+ expected_prompt_list = input_with_prompt.map(&:prompt)
+ assert_dynamic_prompt(lines, expected_prompt_list)
+ end
+
def test_backtick_method
input_with_prompt = [
PromptRow.new('001:0: :> ', %q(self.`(arg))),