summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/assert.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/assert.rb b/test/assert.rb
index 38141d1e8..dc282925f 100644
--- a/test/assert.rb
+++ b/test/assert.rb
@@ -101,20 +101,23 @@ end
def assert_equal(arg1, arg2 = nil, arg3 = nil)
if block_given?
- exp = yield
- act = arg1
- msg = arg2
+ exp, act, msg = yield, arg1, arg2
else
- exp = arg1
- act = arg2
- msg = arg3
+ exp, act, msg = arg1, arg2, arg3
end
+
msg = "Expected to be equal" unless msg
diff = assertion_diff(exp, act)
assert_true(exp == act, msg, diff)
end
-def assert_not_equal(exp, act, msg = nil)
+def assert_not_equal(arg1, arg2 = nil, arg3 = nil)
+ if block_given?
+ exp, act, msg = yield, arg1, arg2
+ else
+ exp, act, msg = arg1, arg2, arg3
+ end
+
msg = "Expected to be not equal" unless msg
diff = assertion_diff(exp, act)
assert_false(exp == act, msg, diff)