summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-10-11 15:31:58 +0900
committergit <svn-admin@ruby-lang.org>2021-10-11 15:39:48 +0900
commit340fabca2c8abe29efe5c5a5c0f3ddc9b2ba8035 (patch)
tree9073b629b3d274085fc8c56329fcc31b9f097726 /test
parent69cedee2a65882c637a815f1d39bf02fa0756114 (diff)
downloadruby-340fabca2c8abe29efe5c5a5c0f3ddc9b2ba8035.tar.gz
[ruby/irb] Set default return_format
https://github.com/ruby/irb/commit/7ee15bc668
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_context.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index ba3b94ce49..d908195e6a 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -448,6 +448,28 @@ module TestIRB
out)
end
+ def test_default_return_format
+ IRB.conf[:PROMPT][:MY_PROMPT] = {
+ :PROMPT_I => "%03n> ",
+ :PROMPT_N => "%03n> ",
+ :PROMPT_S => "%03n> ",
+ :PROMPT_C => "%03n> "
+ # without :RETURN
+ # :RETURN => "%s\n"
+ }
+ IRB.conf[:PROMPT_MODE] = :MY_PROMPT
+ input = TestInputMethod.new([
+ "3"
+ ])
+ irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input)
+ out, err = capture_output do
+ irb.eval_input
+ end
+ assert_empty err
+ assert_equal("3\n",
+ out)
+ end
+
def test_eval_input_with_exception
pend if RUBY_ENGINE == 'truffleruby'
verbose, $VERBOSE = $VERBOSE, nil