eval_error.c: last newline

* eval_error.c (print_errinfo): do not print an empty line at the
  end when the message ends with a newline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-03-13 03:40:10 +00:00
parent e537dc331e
commit b07e4af869
2 changed files with 14 additions and 12 deletions

View file

@ -1255,12 +1255,12 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
_, err2, status1 = EnvUtil.invoke_ruby(['-e', "#{test_method}; begin; foo; end"], '', true, true)
assert_equal(err2, out1)
if $stderr.tty?
e = RuntimeError.new("a\n")
message = assert_nothing_raised(ArgumentError, proc {e.pretty_inspect}) do
e.full_message
end
assert_operator(message, :end_with?, "\n")
e = RuntimeError.new("a\n")
message = assert_nothing_raised(ArgumentError, proc {e.pretty_inspect}) do
e.full_message
end
assert_operator(message, :end_with?, "\n")
message = message.gsub(/\e\[[\d;]*m/, '')
assert_not_operator(message, :end_with?, "\n\n")
end
end