Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress irb_info measures ambiguous_width in command test #1074

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/irb/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@ def without_rdoc(&block)
::Kernel.undef_method :irb_original_require
}
end

def execute_lines(*lines, conf: {}, main: self, irb_path: nil)
# To suppress irb_info measure ambiguous_width with escape sequences
Reline.core.instance_variable_set(:@ambiguous_width, 1)

IRB.init_config(nil)
IRB.conf[:VERBOSE] = false
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf.merge!(conf)
input = TestInputMethod.new(lines)
irb = IRB::Irb.new(IRB::WorkSpace.new(main), input)
irb.context.return_format = "=> %s\n"
irb.context.irb_path = irb_path if irb_path
IRB.conf[:MAIN_CONTEXT] = irb.context
IRB.conf[:USE_PAGER] = false
capture_output do
irb.eval_input
end
end
end

class IntegrationTestCase < TestCase
Expand Down
16 changes: 0 additions & 16 deletions test/irb/test_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,6 @@ def teardown
FileUtils.rm_rf(@tmpdir)
restore_encodings
end

def execute_lines(*lines, conf: {}, main: self, irb_path: nil)
capture_output do
IRB.init_config(nil)
IRB.conf[:VERBOSE] = false
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:USE_PAGER] = false
IRB.conf.merge!(conf)
input = TestInputMethod.new(lines)
irb = IRB::Irb.new(IRB::WorkSpace.new(main), input)
irb.context.return_format = "=> %s\n"
irb.context.irb_path = irb_path if irb_path
IRB.conf[:MAIN_CONTEXT] = irb.context
irb.eval_input
end
end
end

class FrozenObjectTest < CommandTestCase
Expand Down
16 changes: 0 additions & 16 deletions test/irb/test_eval_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,6 @@ def teardown
restore_encodings
end

def execute_lines(*lines, conf: {}, main: self, irb_path: nil)
IRB.init_config(nil)
IRB.conf[:VERBOSE] = false
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:USE_PAGER] = false
IRB.conf.merge!(conf)
input = TestInputMethod.new(lines)
irb = IRB::Irb.new(IRB::WorkSpace.new(main), input)
irb.context.return_format = "=> %s\n"
irb.context.irb_path = irb_path if irb_path
IRB.conf[:MAIN_CONTEXT] = irb.context
capture_output do
irb.eval_input
end
end

def test_eval_history_is_disabled_by_default
out, err = execute_lines(
"a = 1",
Expand Down
16 changes: 0 additions & 16 deletions test/irb/test_helper_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ def teardown
$VERBOSE = @verbosity
restore_encodings
end

def execute_lines(*lines, conf: {}, main: self, irb_path: nil)
IRB.init_config(nil)
IRB.conf[:VERBOSE] = false
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf.merge!(conf)
input = TestInputMethod.new(lines)
irb = IRB::Irb.new(IRB::WorkSpace.new(main), input)
irb.context.return_format = "=> %s\n"
irb.context.irb_path = irb_path if irb_path
IRB.conf[:MAIN_CONTEXT] = irb.context
IRB.conf[:USE_PAGER] = false
capture_output do
irb.eval_input
end
end
end

module TestHelperMethod
Expand Down
Loading