Module:Layout/Production/Test/Call
Deze module is nog in ontwikkeling (versie 0.0) en wordt getest.
De Module:Layout is bedoeld om snel, consistent en uitgebreid een pagina op te maken.
Er is een op de module afgestemde handleiding over deze onderwijswiki beschikbaar.
De module wordt geïnitialiseerd met de configuratie in Module:Layout/Production/Configuration.
Test
bewerkenDeze module test Module:Layout/Production/Model/Call
All 5 tests are ok.
Name | Expected | Actual | |
---|---|---|---|
test_add_debug | |||
test_add_mistake | |||
test_add_new_debug | |||
test_add_new_mistake | |||
test_init |
Code
bewerkenlocal test = {}
local CFG = require( "Module:Layout/Production/Configuration" );
local call = CFG.INCLUDE( "production", "call" );
local unittest = CFG.INCLUDE( "production", "unittest" );
test = unittest:new();
function test.main( frame )
return test.run( frame );
end
function test:test_add_new_debug()
call.add_new_debug( "New debug message" );
local debug_messages = call.debugging;
self:assertEquals( "New debug message", debug_messages[ #debug_messages ], "Adding a new debug message" );
end
function test:test_add_debug()
call.add_new_debug( "First debug message" );
call.add_debug( "Second debug message" );
local debug_messages = call.debugging;
self:assertEquals( "First debug message<br><br>Second debug message", debug_messages[ #debug_messages ], "Appending a debug message" );
end
function test:test_add_new_mistake()
call.add_new_mistake( "New mistake message" );
local mistake_messages = call.mistake;
self:assertEquals( "New mistake message", mistake_messages[ #mistake_messages ], "Adding a new mistake message" );
end
function test:test_add_mistake()
call.add_new_mistake( "First mistake message" );
call.add_mistake( "Second mistake message" );
local mistake_messages = call.mistake;
self:assertEquals( "First mistake message<br><br>Second mistake message", mistake_messages[ #mistake_messages ], "Appending a mistake message" );
end
function test:test_init()
local environment = "test";
call.init( CFG, environment );
self:assertEquals( environment, call.environment, "Setting environment" );
self:assertFunction( call.include, "Setting include function" );
end
return test;