Jump to content

Module:Roman/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Andy M. Wang (talk | contribs) at 07:24, 23 April 2016 (ipairs now makes so much more sense). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Unit tests for [[Module:Roman/sandbox]]. Click talk page to run tests.

local moduleName = 'Roman/sandbox' -- assigning this to a variable as it is later used to generate an #invoke statement.
local mainFuncName = 'main'
local mm = require('Module:' .. moduleName)
local p = require('Module:UnitTests')

function p.buildInvocation(functionName, args)
	args = args or {}
	local ret = '{{#invoke:' .. moduleName .. '|' .. functionName

	for i, arg in ipairs(args) do
		ret = ret .. '|' .. arg
	end

	return ret .. '}}'
end

function p:test_preliminary()
	local argarray = {
		{},
		{},
	}
	
	local invoke = self.buildInvocation(mainFuncName, {'0'})
    self:preprocess_equals(invoke, 'N')
end

return p