diff options
author | Stan Lo <[email protected]> | 2023-11-26 11:07:46 +0000 |
---|---|---|
committer | git <[email protected]> | 2023-11-26 11:07:50 +0000 |
commit | 9cd086ba4b559153864ab924723a665a4ddfb5d8 (patch) | |
tree | ed843d576950bc696e4dcf2bb2cb99e45912f776 /test/irb | |
parent | 0bced53a8a11055d33160aa3f023b4b957e9e497 (diff) |
[ruby/irb] Support disabling pager
(https://github.com/ruby/irb/pull/783)
With either `IRB.conf[:USE_PAGER] = false` or `--no-pager` commnad line flag.
I decided use `--no-pager` instead of `--use-pager` because it matches with
Pry and git's command line flags.
https://github.com/ruby/irb/commit/df1c3b9042
Diffstat (limited to 'test/irb')
-rw-r--r-- | test/irb/test_cmd.rb | 5 | ||||
-rw-r--r-- | test/irb/test_debug_cmd.rb | 6 | ||||
-rw-r--r-- | test/irb/test_irb.rb | 6 |
3 files changed, 7 insertions, 10 deletions
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index 219710c921..62ef7a5b70 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -23,9 +23,6 @@ module TestIRB save_encodings IRB.instance_variable_get(:@CONF).clear @is_win = (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/) - STDIN.singleton_class.define_method :tty? do - false - end end def teardown @@ -34,13 +31,13 @@ module TestIRB Dir.chdir(@pwd) FileUtils.rm_rf(@tmpdir) restore_encodings - STDIN.singleton_class.remove_method :tty? 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) diff --git a/test/irb/test_debug_cmd.rb b/test/irb/test_debug_cmd.rb index d669c174e6..53d40f7297 100644 --- a/test/irb/test_debug_cmd.rb +++ b/test/irb/test_debug_cmd.rb @@ -346,9 +346,11 @@ module TestIRB end def test_show_cmds_display_different_content_when_debugger_is_enabled + write_rc <<~RUBY + IRB.conf[:USE_PAGER] = false + RUBY + write_ruby <<~'ruby' - # disable pager - STDIN.singleton_class.define_method(:tty?) { false } binding.irb ruby diff --git a/test/irb/test_irb.rb b/test/irb/test_irb.rb index b32e857c1e..e6eb3d5da1 100644 --- a/test/irb/test_irb.rb +++ b/test/irb/test_irb.rb @@ -7,8 +7,7 @@ module TestIRB class InputTest < IntegrationTestCase def test_symbol_aliases_are_handled_correctly write_rc <<~RUBY - # disable pager - STDIN.singleton_class.define_method(:tty?) { false } + IRB.conf[:USE_PAGER] = false RUBY write_ruby <<~'RUBY' @@ -27,8 +26,7 @@ module TestIRB def test_symbol_aliases_are_handled_correctly_with_singleline_mode write_rc <<~RUBY - # disable pager - STDIN.singleton_class.define_method(:tty?) { false } + IRB.conf[:USE_PAGER] = false IRB.conf[:USE_SINGLELINE] = true RUBY |