summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-03-03 19:18:47 +0900
committergit <svn-admin@ruby-lang.org>2023-03-03 10:18:51 +0000
commita2b776a9b7f5fc039025a8b92bfbdf3ab0968ce1 (patch)
tree379cd2a8fb7f3fc794660bc4bfcb9def7680564a /test/irb
parentf1fe4a4a99f8ef182b18d90b66f572497a0d41e9 (diff)
downloadruby-a2b776a9b7f5fc039025a8b92bfbdf3ab0968ce1.tar.gz
[ruby/irb] Fix prompt test not to change STDIO.external_encoding
(https://github.com/ruby/irb/pull/535) https://github.com/ruby/irb/commit/09f16259db
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_context.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index fd345f826a..e430a54f4a 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -19,11 +19,13 @@ module TestIRB
def Reline.get_screen_size
[36, 80]
end
+ save_encodings
end
def teardown
Reline.instance_eval { undef :get_screen_size }
Reline.define_singleton_method(:get_screen_size, @get_screen_size)
+ restore_encodings
end
def test_last_value
@@ -658,20 +660,20 @@ module TestIRB
def test_prompt_main_escape
main = Struct.new(:to_s).new("main\a\t\r\n")
- irb = IRB::Irb.new(IRB::WorkSpace.new(main))
+ irb = IRB::Irb.new(IRB::WorkSpace.new(main), TestInputMethod.new)
assert_equal("irb(main )>", irb.prompt('irb(%m)>', nil, 1, 1))
end
def test_prompt_main_inspect_escape
main = Struct.new(:inspect).new("main\\n\nmain")
- irb = IRB::Irb.new(IRB::WorkSpace.new(main))
+ irb = IRB::Irb.new(IRB::WorkSpace.new(main), TestInputMethod.new)
assert_equal("irb(main\\n main)>", irb.prompt('irb(%M)>', nil, 1, 1))
end
def test_prompt_main_truncate
main = Struct.new(:to_s).new("a" * 100)
def main.inspect; to_s.inspect; end
- irb = IRB::Irb.new(IRB::WorkSpace.new(main))
+ irb = IRB::Irb.new(IRB::WorkSpace.new(main), TestInputMethod.new)
assert_equal('irb(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa...)>', irb.prompt('irb(%m)>', nil, 1, 1))
assert_equal('irb("aaaaaaaaaaaaaaaaaaaaaaaaaaaa...)>', irb.prompt('irb(%M)>', nil, 1, 1))
end