mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
69cedee2a6
commit
340fabca2c
2 changed files with 23 additions and 0 deletions
|
@ -386,6 +386,7 @@ module IRB
|
||||||
@prompt_c = pconf[:PROMPT_C]
|
@prompt_c = pconf[:PROMPT_C]
|
||||||
@prompt_n = pconf[:PROMPT_N]
|
@prompt_n = pconf[:PROMPT_N]
|
||||||
@return_format = pconf[:RETURN]
|
@return_format = pconf[:RETURN]
|
||||||
|
@return_format = "%s\n" if @return_format == nil
|
||||||
if ai = pconf.include?(:AUTO_INDENT)
|
if ai = pconf.include?(:AUTO_INDENT)
|
||||||
@auto_indent_mode = ai
|
@auto_indent_mode = ai
|
||||||
else
|
else
|
||||||
|
|
|
@ -448,6 +448,28 @@ module TestIRB
|
||||||
out)
|
out)
|
||||||
end
|
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
|
def test_eval_input_with_exception
|
||||||
pend if RUBY_ENGINE == 'truffleruby'
|
pend if RUBY_ENGINE == 'truffleruby'
|
||||||
verbose, $VERBOSE = $VERBOSE, nil
|
verbose, $VERBOSE = $VERBOSE, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue