DWLegacy Wiki
(adding more data)
(another try)
Line 4: Line 4:
 
local p = require('Dev:UnitTests')
 
local p = require('Dev:UnitTests')
   
local docDump = "xxxxx"
+
local docDump = 'xxxxx'
local allyDump = "yyyyy"
+
local allyDump = 'yyyyy'
   
 
function p:test_hello()
 
function p:test_hello()
Line 17: Line 17:
 
self:preprocess_equals('{{#invoke:PlayablesCode | main | D | yyy }}', 'main ok: DorA=d : yyy')
 
self:preprocess_equals('{{#invoke:PlayablesCode | main | D | yyy }}', 'main ok: DorA=d : yyy')
 
self:preprocess_equals('{{#invoke:PlayablesCode | main | A | yyy }}', 'main ok: DorA=d : yyy')
 
self:preprocess_equals('{{#invoke:PlayablesCode | main | A | yyy }}', 'main ok: DorA=d : yyy')
self:preprocess_equals('{{#invoke:PlayablesCode | main | D | dump }}', docdump )
+
self:preprocess_equals('{{#invoke:PlayablesCode | main | D | dump }}', docDump )
self:preprocess_equals('{{#invoke:PlayablesCode | main | A | dump }}', allydump )
+
self:preprocess_equals('{{#invoke:PlayablesCode | main | A | dump }}', allyDump )
 
end
 
end
   

Revision as of 15:08, 13 November 2018

Documentation for this module may be created at Module:Playables/testcases/doc

-- Playables/testcases module

-- Unit tests for Module:PlayablesCode. Click talk page to run tests.
local p = require('Dev:UnitTests')

local docDump = 'xxxxx'
local allyDump = 'yyyyy'

function p:test_hello()
	self:preprocess_equals('{{#invoke:PlayablesCode | hello}}', 'Hello, world!')
end

function p:test_main()
	self:preprocess_equals('{{#invoke:PlayablesCode | main}}', 'invalid call to PlayablesCode-main: zero arguments passed')
	self:preprocess_equals('{{#invoke:PlayablesCode | main | xxx }}', 'xxx')
	self:preprocess_equals('{{#invoke:PlayablesCode | main | xxx | yyy }}', 'xxx')
	self:preprocess_equals('{{#invoke:PlayablesCode | main | D | yyy }}', 'main ok: DorA=d : yyy')
	self:preprocess_equals('{{#invoke:PlayablesCode | main | A | yyy }}', 'main ok: DorA=d : yyy')
	self:preprocess_equals('{{#invoke:PlayablesCode | main | D | dump }}', docDump )
	self:preprocess_equals('{{#invoke:PlayablesCode | main | A | dump }}', allyDump )
end

function p:test_GoodKey()
	self:preprocess_equals('{{#invoke:PlayablesCode | isGoodKey}}', 'false')
	self:preprocess_equals('{{#invoke:PlayablesCode | isGoodKey | xxx }}', 'false')
	self:preprocess_equals('{{#invoke:PlayablesCode | isGoodKey | AllDoctors }}', 'true')
	self:preprocess_equals('{{#invoke:PlayablesCode | isGoodKey | The First Doctor }}', 'true')
end


return p