diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb
index 179108333..24e8dea7d 100644
--- a/test/irb/test_ruby_lex.rb
+++ b/test/irb/test_ruby_lex.rb
@@ -235,64 +235,60 @@ def test_symbols
def test_endless_range_at_end_of_line
input_with_prompt = [
- PromptRow.new('001:0: :> ', %q(a = 3..)),
- PromptRow.new('002:0: :> ', %q()),
+ ['001:0: :> ', %q(a = 3..)],
+ ['002:0: :> ', %q()],
]
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
def test_heredoc_with_embexpr
input_with_prompt = [
- PromptRow.new('001:0:":* ', %q(< ', %q(])),
- PromptRow.new('012:0: :> ', %q()),
- ]
-
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ ['001:0:":* ', %q(< ', %q(])],
+ ['012:0: :> ', %q()],
+ ]
+
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
def test_heredoc_prompt_with_quotes
input_with_prompt = [
- PromptRow.new("001:1:':* ", %q(<<~'A')),
- PromptRow.new("002:1:':* ", %q(#{foobar})),
- PromptRow.new("003:0: :> ", %q(A)),
- PromptRow.new("004:1:`:* ", %q(<<~`A`)),
- PromptRow.new("005:1:`:* ", %q(whoami)),
- PromptRow.new("006:0: :> ", %q(A)),
- PromptRow.new('007:1:":* ', %q(<<~"A")),
- PromptRow.new('008:1:":* ', %q(foobar)),
- PromptRow.new('009:0: :> ', %q(A)),
- ]
-
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ ["001:1:':* ", %q(<<~'A')],
+ ["002:1:':* ", %q(#{foobar})],
+ ["003:0: :> ", %q(A)],
+ ["004:1:`:* ", %q(<<~`A`)],
+ ["005:1:`:* ", %q(whoami)],
+ ["006:0: :> ", %q(A)],
+ ['007:1:":* ', %q(<<~"A")],
+ ['008:1:":* ', %q(foobar)],
+ ['009:0: :> ', %q(A)],
+ ]
+
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
def test_backtick_method
input_with_prompt = [
- PromptRow.new('001:0: :> ', %q(self.`(arg))),
- PromptRow.new('002:0: :> ', %q()),
- PromptRow.new('003:0: :> ', %q(def `(); end)),
- PromptRow.new('004:0: :> ', %q()),
+ ['001:0: :> ', %q(self.`(arg))],
+ ['002:0: :> ', %q()],
+ ['003:0: :> ', %q(def `(); end)],
+ ['004:0: :> ', %q()],
]
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
@@ -593,8 +589,6 @@ def test_heredoc_keep_indent_spaces
end
end
- PromptRow = Struct.new(:prompt, :content)
-
class MockIO_DynamicPrompt
def initialize(params, &assertion)
@params = params
@@ -680,57 +674,53 @@ def assert_dynamic_prompt(lines, expected_prompt_list)
def test_dynamic_prompt
input_with_prompt = [
- PromptRow.new('001:1: :* ', %q(def hoge)),
- PromptRow.new('002:1: :* ', %q( 3)),
- PromptRow.new('003:0: :> ', %q(end)),
+ ['001:1: :* ', %q(def hoge)],
+ ['002:1: :* ', %q( 3)],
+ ['003:0: :> ', %q(end)],
]
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
def test_dynamic_prompt_with_double_newline_breaking_code
input_with_prompt = [
- PromptRow.new('001:1: :* ', %q(if true)),
- PromptRow.new('002:1: :* ', %q(%)),
- PromptRow.new('003:1: :* ', %q(;end)),
- PromptRow.new('004:1: :* ', %q(;hello)),
- PromptRow.new('005:0: :> ', %q(end)),
+ ['001:1: :* ', %q(if true)],
+ ['002:1: :* ', %q(%)],
+ ['003:1: :* ', %q(;end)],
+ ['004:1: :* ', %q(;hello)],
+ ['005:0: :> ', %q(end)],
]
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
def test_dynamic_prompt_with_multiline_literal
input_with_prompt = [
- PromptRow.new('001:1: :* ', %q(if true)),
- PromptRow.new('002:1:]:* ', %q( %w[)),
- PromptRow.new('003:1:]:* ', %q( a)),
- PromptRow.new('004:1: :* ', %q( ])),
- PromptRow.new('005:1: :* ', %q( b)),
- PromptRow.new('006:1:]:* ', %q( %w[)),
- PromptRow.new('007:1:]:* ', %q( c)),
- PromptRow.new('008:1: :* ', %q( ])),
- PromptRow.new('009:0: :> ', %q(end)),
- ]
-
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ ['001:1: :* ', %q(if true)],
+ ['002:1:]:* ', %q( %w[)],
+ ['003:1:]:* ', %q( a)],
+ ['004:1: :* ', %q( ])],
+ ['005:1: :* ', %q( b)],
+ ['006:1:]:* ', %q( %w[)],
+ ['007:1:]:* ', %q( c)],
+ ['008:1: :* ', %q( ])],
+ ['009:0: :> ', %q(end)],
+ ]
+
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end
def test_dynamic_prompt_with_blank_line
input_with_prompt = [
- PromptRow.new('001:0:]:* ', %q(%w[)),
- PromptRow.new('002:0:]:* ', %q()),
- PromptRow.new('003:0: :> ', %q(])),
+ ['001:0:]:* ', %q(%w[)],
+ ['002:0:]:* ', %q()],
+ ['003:0: :> ', %q(])],
]
- lines = input_with_prompt.map(&:content)
- expected_prompt_list = input_with_prompt.map(&:prompt)
+ expected_prompt_list, lines = input_with_prompt.transpose
assert_dynamic_prompt(lines, expected_prompt_list)
end