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.

Controleer op scriptfouten of opmaak notificaties.


Deze module test Module:Layout/Production/Model/Call

Yes All 5 tests are ok.

NameExpectedActual
Yestest_add_debug
Yestest_add_mistake
Yestest_add_new_debug
Yestest_add_new_mistake
Yestest_init



local 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;
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.