// tutorial8.ot
group "tutorial_8";
test("See what happens with multiple verifies")
{
output("Hello\n");
verify(2 == 2);
output("Hi\n");
verify(4 == 5);
output("Whatsup\n");
verify(3 == 3);
output("Howdi\n");
verify(5 == 6);
output("Yo\n");
}
In this example, the first verify will succeed, but the second will fail. When a verify fails, no more expressions in the test will be evaluated.
A new command in Selftest is introduced here, output. output works the same way as printf, with the difference that it will work with Visual Studio's debug window. As you can see, only "Hello" and "Hi" goes to the output, the rest of them will not be written, since the second verify already has failed.
========================================================================= Opera Testsuite ========================================================================= ========================================================================= E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial8.ot(2): tutorial_8 ========================================================================= See what happens with multiple verifies ....................... Hello Hi FAILED E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial8.ot(9): '4' should be 5. The value is 4 ========================================================================= 1 test run, 1 test failed, 0 tests skipped, 0 tests OK Place a breakpoint in testsuite_break_here() to debug the failed test =========================================================================