eval_error.c: fix underflow

* eval_error.c (print_errinfo): get rid of negative string length.
  [ruby-core:86086] [Bug #14598]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-03-12 13:04:28 +00:00
parent 7773cfa496
commit 2851b2c55f
2 changed files with 10 additions and 4 deletions

View file

@ -1254,5 +1254,13 @@ $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")
end
end
end