Module:Testharness

-- Unit tests. Click talk page to run tests. local tester = require('Dev:UnitTests') local sTestCases = {} local p ={} function p.run_tests(frame) local moduleName = mw.title.getCurrentTitle.baseText or        frame.args.name  or frame.args[1] local functionName = frame.args.fname or frame.args[2] or "main" local isnowiki = frame.args.nowiki or frame.args[3] sTestCases = mw.loadData("Dev:"..moduleName .."/testdata") if sTestCases and type(sTestCases)=="table" then testSuite(moduleName,functionName,sTestCases,{nowiki=isnowiki}) return tester.run_tests(frame) end end function testSuite(moduleName,functionName,testcases,options) tester["test_"..moduleName] = function (tester) argPrefix = argPrefix or "" argSuffix = argSuffix or "" tester:preprocess_equals_many('', testcases,options) end end return p