Skip to content

Commit ea8c716

Browse files
committed
Fix CI failure on ruby/ruby
1 parent 4321674 commit ea8c716

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

test/irb/test_cmd.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,24 @@
55
require_relative "helper"
66

77
module TestIRB
8-
class ExtendCommandTest < TestCase
8+
class CommandTestCase < TestCase
9+
def execute_lines(*lines, conf: {}, main: self, irb_path: nil)
10+
IRB.init_config(nil)
11+
IRB.conf[:VERBOSE] = false
12+
IRB.conf[:PROMPT_MODE] = :SIMPLE
13+
IRB.conf.merge!(conf)
14+
input = TestInputMethod.new(lines)
15+
irb = IRB::Irb.new(IRB::WorkSpace.new(main), input)
16+
irb.context.return_format = "=> %s\n"
17+
irb.context.irb_path = irb_path if irb_path
18+
IRB.conf[:MAIN_CONTEXT] = irb.context
19+
capture_output do
20+
irb.eval_input
21+
end
22+
end
23+
end
24+
25+
class ExtendCommandTest < CommandTestCase
926
def setup
1027
@pwd = Dir.pwd
1128
@tmpdir = File.join(Dir.tmpdir, "test_reline_config_#{$$}")
@@ -523,7 +540,7 @@ def test_show_source_end_finder
523540
def show_source_test_method
524541
unless true
525542
end
526-
end
543+
end unless defined?(show_source_test_method)
527544
EOS
528545

529546
out, err = execute_lines(
@@ -565,7 +582,7 @@ def test_vars_with_aliases
565582
$bar = nil
566583
end
567584

568-
class EditTest < ExtendCommandTest
585+
class EditTest < CommandTestCase
569586
def setup
570587
@original_editor = ENV["EDITOR"]
571588
# noop the command so nothing gets executed
@@ -639,22 +656,5 @@ def test_edit_with_instance_method
639656
assert_match("command: ': code'", out)
640657
end
641658
end
642-
643-
private
644-
645-
def execute_lines(*lines, conf: {}, main: self, irb_path: nil)
646-
IRB.init_config(nil)
647-
IRB.conf[:VERBOSE] = false
648-
IRB.conf[:PROMPT_MODE] = :SIMPLE
649-
IRB.conf.merge!(conf)
650-
input = TestInputMethod.new(lines)
651-
irb = IRB::Irb.new(IRB::WorkSpace.new(main), input)
652-
irb.context.return_format = "=> %s\n"
653-
irb.context.irb_path = irb_path if irb_path
654-
IRB.conf[:MAIN_CONTEXT] = irb.context
655-
capture_output do
656-
irb.eval_input
657-
end
658-
end
659659
end
660660
end

0 commit comments

Comments
 (0)