Module:TimeSwitch/testcases

-- -- Unit tests for Module:TimeSwithc. Click talk page to run tests.

local p = require("Dev:UnitTests") local date = require("Dev:Date")

function p:test_main -- some testdates relative to run-time local pastDate1 = date.addyears(-2) local pastDate2 = date.addmonths(-1) local pastDate3 = date.adddays(-3) local futureDate1 = date.adddays(6) local futureDate2 = date.addmonths(4) local futureDate3 = date.addyears(5) -- the string for the category-output local category = "" self:preprocess_equals_many('', {       { 'Hello', 'Hello' .. category },        { 'Hello|' .. pastDate1, category },        { 'Hello|' .. pastDate2, category },        { 'Hello|' .. pastDate3, category },        { 'Hello|' .. futureDate1, 'Hello' },        { 'Hello|' .. futureDate2, 'Hello' },        { 'Hello|' .. futureDate3, 'Hello' },        { 'Hello|' .. pastDate1 .. '|World', 'World' .. category },        { 'Hello|' .. futureDate1 .. '|World', 'Hello' },        { 'Hello|' .. pastDate1 .. '|World,|' .. pastDate2 .. '|how|' .. pastDate3 .. '|are' .. futureDate1 .. '|you?', 'are' }    }) end

return p

-- --