diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-07-30 12:46:24 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-07-30 13:05:01 +0900 |
| commit | 44381f0a0c306a8c778f546926d3febfdf981b45 (patch) | |
| tree | 4dab936e4d182906b3c32a3c810f09d1f4add693 /test | |
| parent | ff43b2b97c77812abbcbfe14da4582c6c209be9b (diff) | |
| download | mruby-44381f0a0c306a8c778f546926d3febfdf981b45.tar.gz mruby-44381f0a0c306a8c778f546926d3febfdf981b45.zip | |
Refine message to `skip` in nested `assert`
- I think "Info" is used only to `skip`, so change to "Skip".
- Changed the default value of `assert` and specify the argument explicitly
at the caller of `assert` because it is unnatural "Assertion failed" is
output even though the assertion doesn't fail.
== Example:
def assert_foo(exp, act)
assert do
assert_equal exp[0], act[0]
assert_equal exp[1], act[1]
end
end
def assert_bar(exp, act)
assert do
skip
end
end
def assert_baz(exp, act)
assert do
assert_equal exp, act
assert_bar exp, act
end
end
assert 'test#skip_in_nested_assert' do
assert_baz 1, 1
end
=== Before this patch:
?..
Info: test#skip_in_nested_assert (core)
- Assertion[1]
Info: Assertion failed (core)
- Assertion[1-2]
Skip: Assertion failed (core)
Total: 3
OK: 2
KO: 0
Crash: 0
Warning: 0
Skip: 1
=== After this patch:
???
Skip: test#skip_in_nested_assert (core)
- Assertion[1]
Skip: assert (core)
- Assertion[1-2]
Skip: assert (core)
Total: 3
OK: 0
KO: 0
Crash: 0
Warning: 0
Skip: 3
Diffstat (limited to 'test')
| -rw-r--r-- | test/assert.rb | 8 | ||||
| -rw-r--r-- | test/t/numeric.rb | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/assert.rb b/test/assert.rb index 58ee4b913..5ae46ca70 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -76,7 +76,7 @@ end # iso : The ISO reference code of the feature # which will be tested by this # assertion -def assert(str = 'Assertion failed', iso = '') +def assert(str = 'assert', iso = '') t_print(str, (iso != '' ? " [#{iso}]" : ''), ' : ') if $mrbtest_verbose begin $mrbtest_child_noassert ||= [0] @@ -99,10 +99,10 @@ def assert(str = 'Assertion failed', iso = '') yield if $mrbtest_assert.size > 0 if $mrbtest_assert.size == $mrbtest_child_noassert[-1] - $asserts.push(assertion_string('Info: ', str, iso)) + $asserts.push(assertion_string('Skip: ', str, iso)) $mrbtest_child_noassert[-2] += 1 - $ok_test += 1 - t_print('.') + $skip_test += 1 + t_print('?') else $asserts.push(assertion_string('Fail: ', str, iso)) $ko_test += 1 diff --git a/test/t/numeric.rb b/test/t/numeric.rb index bb95f8ef3..5b1e79153 100644 --- a/test/t/numeric.rb +++ b/test/t/numeric.rb @@ -8,7 +8,7 @@ def assert_step(exp, receiver, args, inf: false) break if inf && exp.size == act.size end expr = "#{receiver.inspect}.step(#{args.map(&:inspect).join(', ')})" - assert do + assert "assert_step" do assert_true(exp.eql?(act), "#{expr}: counters", assertion_diff(exp, act)) assert_same(receiver, ret, "#{expr}: return value") unless inf end |
