Jump to content

Module:Wd/sandbox/testcases/common

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Janhrach (talk | contribs) at 18:59, 15 August 2023 (Support for optimization). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
-- generates unit test object to be returned by a specific testcase module
-- first argument: name of the module to test
-- second argument: a table with the structure described in testcaseTable or a module name
function generate_unit_tests_object(module_to_test, correct_outputs)
	local p = require("Module:UnitTests")
    
    -- TODO: handle the testcase 3
    function p:test()
	    self:preprocess_equals_many(
	    	"{{#invoke:" .. module_to_test .. "|",
	    	"}}",
		    correct_outputs
	    )
    end
    
    return p
end