local mSandbox = require('Module:Check winner by scores/sandbox') -- the module to be testedlocal ScribuntoUnit = require('Module:ScribuntoUnit')local suite = ScribuntoUnit:newlocal frame = mw.getCurrentFrame
---------------------------------------------------------------------------------- Helper functions--------------------------------------------------------------------------------
local function makeFrameWithArgs(args) local frame = frame:newChild return frameend
local function execTest(args) return mSandbox.main(makeFrameWithArgs(args))end
function suite:assertEq(expected, actual) expected = expected self:assertEquals(mw.text.trim(expected), mw.text.trim(actual))end
function suite:assertErr(actual) self:assertEquals(mw.text.trim('Result unknown'), mw.text.trim(actual))end
---------------------------------------------------------------------------------- One unnamed parameter test--------------------------------------------------------------------------------
function suite:test1up_hWin_WL self:assertEq('W', execTest)end
function suite:test1up_hLoss_LW self:assertEq('L', execTest)end
function suite:test1up_hWin_minusSign self:assertEq('W', execTest)end
function suite:test1up_hLoss_minusSign self:assertEq('L', execTest)end
function suite:test1up_hWin_enDash self:assertEq('W', execTest)end
function suite:test1up_hLoss_enDash self:assertEq('L', execTest)end
function suite:test1up_hWin_wikiLink self:assertEq('W', execTest)end
function suite:test1up_hLoss_wikiLink self:assertEq('L', execTest)end
function suite:test1up_hWin_externalLink self:assertEq('W', execTest)end
function suite:test1up_hLoss_externalLink self:assertEq('L', execTest)end
function suite:test1up_noAwayScore self:assertEq("Result unknown", execTest)end
function suite:test1up_noAwayScore_negativeHomeScore self:assertEq("Result unknown", execTest)end
function suite:test1up_alphabeticScores self:assertEq("Result unknown", execTest)end
function suite:test1up_hWin_homeScoreInBoldMarkup self:assertEq("W", execTest)end
function suite:test1up_hWin_awayScoreInBoldMarkup self:assertEq("L", execTest)end
function suite:test1up_hWin_scoresInBoldMarkup self:assertEq("W", execTest)end
function suite:test1up_hWin_homeScoreInItalicMarkup self:assertEq("W", execTest)end
function suite:test1up_hLoss_awayScoreInItalicMarkup self:assertEq("L", execTest)end
function suite:test1up_hWin_scoresInItalicMarkup self:assertEq("W", execTest)end
---------------------------------------------------------------------------------- Two unnamed parameters test--------------------------------------------------------------------------------
function suite:testSc_hWin_WL self:assertEq('W', execTest)end
function suite:test2up_hLoss_LW self:assertEq('L', execTest)end
function suite:test2up_hWin_minusSign self:assertEq('W', execTest)end
function suite:test2up_hLoss_minusSign self:assertEq('L', execTest)end
function suite:test2up_hWin_enDash self:assertEq('W', execTest)end
function suite:test2up_hLoss_enDash self:assertEq('L', execTest)end
function suite:test2up_noAwayScore self:assertEq("Result unknown", execTest)end
function suite:test2up_noAwayScore_negativeHomeScore self:assertEq("Result unknown", execTest)end
function suite:test2up_alphabeticScores self:assertEq("Result unknown", execTest)end
function suite:test2up_hWin_homeScoreInBoldMarkup self:assertEq("W", execTest)end
function suite:test2up_hWin_awayScoreInBoldMarkup self:assertEq("L", execTest)end
function suite:test2up_hWin_scoresInBoldMarkup self:assertEq("W", execTest)end
function suite:test2up_hWin_homeScoreInItalicMarkup self:assertEq("W", execTest)end
function suite:test2up_hLoss_awayScoreInItalicMarkup self:assertEq("L", execTest)end
function suite:test2up_hWin_scoresInItalicMarkup self:assertEq("W", execTest)end
---------------------------------------------------------------------------------- 'sc' parameter test--------------------------------------------------------------------------------
function suite:testSc_hWin_WL self:assertEq('W', execTest)end
function suite:testSc_hLoss_LW self:assertEq('L', execTest)end
function suite:testSc_hWin_minusSign self:assertEq('W', execTest)end
function suite:testSc_hLoss_minusSign self:assertEq('L', execTest)end
function suite:testSc_hWin_enDash self:assertEq('W', execTest)end
function suite:testSc_hLoss_enDash self:assertEq('L', execTest)end
function suite:testSc_hWin_wikiLink self:assertEq('W', execTest)end
function suite:testSc_hLoss_wikiLink self:assertEq('L', execTest)end
function suite:testSc_hWin_externalLink self:assertEq('W', execTest)end
function suite:testSc_hLoss_externalLink self:assertEq('L', execTest)end
function suite:testSc_alphabeticScores self:assertEq("Result unknown", execTest)end
function suite:testSc_hWin_homeScoreInBoldMarkup self:assertEq("W", execTest)end
function suite:testSc_hWin_awayScoreInBoldMarkup self:assertEq("L", execTest)end
function suite:testSc_hWin_scoresInBoldMarkup self:assertEq("W", execTest)end
function suite:testSc_hWin_homeScoreInItalicMarkup self:assertEq("W", execTest)end
function suite:testSc_hLoss_awayScoreInItalicMarkup self:assertEq("L", execTest)end
function suite:testSc_hWin_scoresInItalicMarkup self:assertEq("W", execTest)end
return suite