Module:User:Theknightwho/parser/testcases

local tests = require("Module:UnitTests")

local nowiki = require("Module:string utilities").nowiki local u = mw.ustring.char

local frame = mw.getCurrentFrame local parser = require("Module:User:Theknightwho/parser")

function tests:test_variables for _, example in ipairs{"!", "=", "ARTICLEPAGENAME", "ARTICLEPAGENAMEE", "ARTICLEPATH", "ARTICLESPACE", "ARTICLESPACEE", "BASEPAGENAME", "BASEPAGENAMEE", "CASCADINGSOURCES", "CONTENTLANG", "CONTENTLANGUAGE", "CURRENTDAY", "CURRENTDAY2", "CURRENTDAYNAME", "CURRENTDOW", "CURRENTHOUR", "CURRENTMONTH", "CURRENTMONTH1", "CURRENTMONTH2", "CURRENTMONTHABBREV", "CURRENTMONTHNAME", "CURRENTMONTHNAMEGEN", "CURRENTTIME", "CURRENTTIMESTAMP", "CURRENTVERSION", "CURRENTWEEK", "CURRENTYEAR", "DIRECTIONMARK", "DIRMARK", "FULLPAGENAME", "FULLPAGENAMEE", "LOCALDAY", "LOCALDAY2", "LOCALDAYNAME", "LOCALDOW", "LOCALHOUR", "LOCALMONTH", "LOCALMONTH1", "LOCALMONTH2", "LOCALMONTHABBREV", "LOCALMONTHNAME", "LOCALMONTHNAMEGEN", "LOCALTIME", "LOCALTIMESTAMP", "LOCALWEEK", "LOCALYEAR", "NAMESPACE", "NAMESPACEE", "NAMESPACENUMBER", "NOEXTERNALLANGLINKS", "NUMBEROFACTIVEUSERS", "NUMBEROFADMINS", "NUMBEROFARTICLES", "NUMBEROFEDITS", "NUMBEROFFILES", "NUMBEROFPAGES", "NUMBEROFUSERS", "PAGEID", "PAGELANGUAGE", "PAGENAME", "PAGENAMEE", "REVISIONDAY", "REVISIONDAY2", "REVISIONID", "REVISIONMONTH", "REVISIONMONTH1", "REVISIONSIZE", "REVISIONTIMESTAMP", "REVISIONUSER", "REVISIONYEAR", "ROOTPAGENAME", "ROOTPAGENAMEE", "SCRIPTPATH", "SERVER", "SERVERNAME", "SITENAME", "STYLEPATH", "SUBJECTPAGENAME", "SUBJECTPAGENAMEE", "SUBJECTSPACE", "SUBJECTSPACEE", "SUBPAGENAME", "SUBPAGENAMEE", "TALKPAGENAME", "TALKPAGENAMEE", "TALKSPACE", "TALKSPACEE"} do		example = table.concat{""} tests:equals(" ", parser:parse(example), frame:really_preprocess(example), {nowiki = true}) end end

function tests:test_parser_functions for _, v in ipairs{"URLENCODE"} do		for i = 0, 127 do			local example = table.concat{""} tests:equals(" ", parser:parse(example), frame:really_preprocess(example), {nowiki = true}) end end end

return tests