Unverified Commit 76262b8e authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4288 from shuujii/assert_true-should-pass-when-actual-is-only-true

`assert_true`/`assert_false` should pass when actual is only `true`/`false`
parents baf8fbe6 244abdae
...@@ -78,7 +78,7 @@ end ...@@ -78,7 +78,7 @@ end
def assert_true(ret, msg = nil, diff = nil) def assert_true(ret, msg = nil, diff = nil)
if $mrbtest_assert if $mrbtest_assert
$mrbtest_assert_idx += 1 $mrbtest_assert_idx += 1
unless ret unless ret == true
msg ||= "Expected #{ret.inspect} to be true" msg ||= "Expected #{ret.inspect} to be true"
diff ||= assertion_diff(true, ret) diff ||= assertion_diff(true, ret)
$mrbtest_assert.push([$mrbtest_assert_idx, msg, diff]) $mrbtest_assert.push([$mrbtest_assert_idx, msg, diff])
...@@ -88,7 +88,7 @@ def assert_true(ret, msg = nil, diff = nil) ...@@ -88,7 +88,7 @@ def assert_true(ret, msg = nil, diff = nil)
end end
def assert_false(ret, msg = nil, diff = nil) def assert_false(ret, msg = nil, diff = nil)
if ret unless ret == false
msg ||= "Expected #{ret.inspect} to be false" msg ||= "Expected #{ret.inspect} to be false"
diff ||= assertion_diff(false, ret) diff ||= assertion_diff(false, ret)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment