Test a function: Difference between revisions

→‎{{header|Phix}}: enhanced output, set_wait_on_summary() has been renamed as set_test_pause()
m (→‎{{header|Phix}}: comment -> use new requires() builtin)
(→‎{{header|Phix}}: enhanced output, set_wait_on_summary() has been renamed as set_test_pause())
Line 1,468:
--set_test_verbosity(TEST_QUIET) -- (default, no output when third call removed)
--set_test_verbosity(TEST_SUMMARY) -- (first and last line only [w or w/o ""])
--set_test_verbosity(TEST_SHOW_FAILED_ONLYTEST_SHOW_FAILED) -- (first and last two lines only)
set_test_verbosity(TEST_SHOW_ALL) -- (as shown in last two cases below)
 
--set_wait_on_summaryset_test_pause(-1) -- (pause on failure [default])
--set_wait_on_summaryset_test_pause(0) -- (disable pause on failure)
--set_wait_on_summaryset_test_pause(1) -- (always pause)
 
set_test_module("palindromes") -- (optional, w/o first line is omitted)
Line 1,486:
Note the default behaviour, if set_test_verbosity() is not invoked, is no output and carry on as normal when all tests pass.
{{out}}
TEST_QUIET with a failing test (no output or pause if no failing tests)<br>
TEST_SUMMARY with a failure, same output
<pre>
palindromes:
 
4 tests run, 3 passed, 1 failed, 75% success
Press any key to continue...
</pre>
TEST_SUMMARY with no failure (and w/o set_test_pause(1))<br>
TEST_SHOW_FAILED with no failure, ditto
<pre>
palindromes:
 
3 tests run, 3 passed, 0 failed, 100% success
</pre>
TEST_SHOW_FAILED with a failure
<pre>
palindromes:
failed: failure
 
4 tests run, 3 passed, 1 failed, 75% success
Press any key to continue...
</pre>
TEST_SHOW_ALL with a failure
<pre>
palindromes:
Line 1,494 ⟶ 1,518:
4 tests run, 3 passed, 1 failed, 75% success
Press any key to continue...
</pre>
TEST_SHOW_ALL with no failure (and w/o set_test_pause(1))
<pre>
palindromes:
passed: abba
passed: not abc
 
3 tests run, 3 passed, 0 failed, 100% success
</pre>
 
7,813

edits