Skip to content

Commit

Permalink
eval_error.c: default nil as "reverse" is now false [Feature #8661]
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Apr 21, 2020
1 parent bf11bf3 commit 3ef09c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions eval_error.c
Expand Up @@ -309,9 +309,9 @@ rb_error_write(VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE highlig
errat = Qnil;
}
eclass = CLASS_OF(errinfo);
if (NIL_P(reverse) || NIL_P(highlight)) {
if (NIL_P(reverse)) reverse = Qfalse;
if (NIL_P(highlight)) {
VALUE tty = (VALUE)rb_stderr_tty_p();
if (NIL_P(reverse)) reverse = tty;
if (NIL_P(highlight)) highlight = tty;
}
if (reverse) {
Expand Down
6 changes: 2 additions & 4 deletions test/ruby/test_exception.rb
Expand Up @@ -1156,13 +1156,11 @@ def test_full_message
if Exception.to_tty?
assert_match(/\e/, message)
message = message.gsub(/\e\[[\d;]*m/, '')
assert_operator(message, :start_with?, remark)
assert_operator(message, :end_with?, bottom)
else
assert_not_match(/\e/, message)
assert_operator(message, :start_with?, bottom)
assert_operator(message, :end_with?, top)
end
assert_operator(message, :start_with?, bottom)
assert_operator(message, :end_with?, top)
end

def test_exception_in_message
Expand Down

0 comments on commit 3ef09c6

Please sign in to comment.