Add a test for #22.

This commit is contained in:
David Given 2016-12-06 22:07:22 +01:00
parent 67e7d226ad
commit 1039c0a747
3 changed files with 31 additions and 4 deletions

View file

@ -0,0 +1,26 @@
MODULE test;
FROM InOut IMPORT WriteLn, WriteString;
TYPE charset = SET OF CHAR;
PROCEDURE Space(c: CHAR): BOOLEAN;
BEGIN
RETURN c IN charset{' ', 11C, 12C, 15C}
END Space;
BEGIN
IF Space('a') THEN
WriteString("@@FAIL 1");
WriteLn;
END;
IF NOT Space(' ') THEN
WriteString("@@FAIL 2");
WriteLn;
END;
IF NOT Space(12C) THEN
WriteString("@@FAIL 3");
WriteLn;
END;
WriteString("@@FINISHED");
WriteLn;
END test.

View file

@ -11,7 +11,8 @@ definerule("plat_testsuite",
local testfiles = filenamesof(
"tests/plat/*.c",
"tests/plat/*.e",
"tests/plat/*.p"
"tests/plat/*.p",
"tests/plat/bugs/*.mod"
)
acklibrary {
@ -23,8 +24,8 @@ definerule("plat_testsuite",
local tests = {}
for _, f in ipairs(testfiles) do
local fs = replace(basename(f), "%..$", "")
local _, _, lang = fs:find("_(.)$")
local fs = replace(basename(f), "%.[^.]+$", "")
local _, _, lang = fs:find("_([^_]+)$")
if not lang then
lang = "e"
end
@ -49,7 +50,7 @@ definerule("plat_testsuite",
"util/build+testrunner"
},
commands = {
"(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo FAILED) 2>&1 > %{outs}",
"(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo FAILED) > %{outs}",
}
}
end