Jump to content

Module:Template test case: Difference between revisions

tentative TestCase class syntax
(first draft of the spec for a generalised template test cases module)
 
(tentative TestCase class syntax)
Line 1: Line 1:
-- This module provides several methods to generate test cases.
-- This module provides several methods to generate test cases.
local libraryUtil = require('libraryUtil')
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 22: Line 25:
--    * heading - a heading to display above the template output.
--    * heading - a heading to display above the template output.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- TestCase class
-------------------------------------------------------------------------------
local TestCase = {}
TestCase.__index = TestCase
function TestCase.new(t)
-- Validate the input
checkTypeForNamedArg('TestCase.new', 'invocation', t.invocation, 'table')
checkTypeForNamedArg('TestCase.new', 'templates', t.templates, 'table')
checkTypeForNamedArg('TestCase.new', 'options', t.options, 'table', true)
t.options = t.options or {}
local obj = setmetatable({}, TestCase)
return obj
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.