// tutorial13.ot
group "tutorial_13";
include "core/mem_man.h";
test("Only if Opera has started") require init;
{
verify(g_memory_manager->MaxDocMemory() > 1000); // This test will crash if Opera isn't initialized.
}
test("Only if Opera hasn't started") require noinit;
{
g_memory_manager = new MemoryManager(); // This test will leak if Opera is initialized.
}
The first test has require init, which means that Opera must be initialized to run this test. The second test will only run if Opera is not started. A normal test, with no such requirement, will run in both cases. Normally, Opera will be initialized when running the tests. If you add now to the command line argument, like -test-now, Opera will not be initialized, and tests with require init will not run.
========================================================================= Opera Testsuite ========================================================================= ========================================================================= E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial13.ot(2): tutorial_13 ========================================================================= Only if Opera has started ..................................... FAILED E:/src/operaclean/opera-windows7/modules/selftest/documentation/tutorial/tutorial13.ot(8): 'g_memory_manager->MaxDocMemory()' should be bigger than 1000. The value is 0 Only if Opera hasn't started .................................. Skipped (opera was initialized) ========================================================================= 1 test run, 1 test failed, 1 test skipped, 0 tests OK Place a breakpoint in testsuite_break_here() to debug the failed test =========================================================================