git @ Cat's Eye Technologies Falderal / c1b7341
Generate results of all tests from generated shell scripts too. catseye 10 years ago
1 changed file(s) with 7 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
4343 format _ blocks =
4444 prelude ++ (formatBlocks blocks) ++ postlude
4545
46 formatBlocks (test@(Test id [(ShellTest cmd)] desc input expectation _):rest) =
46 formatBlocks (test@(Test id [(ShellTest cmd)] desc input _ _):rest) =
4747 let
48 expected = case expectation of
49 Output e -> e
50 Exception e -> e -- XXX should we expect this on stderr?
5148 inputHereDoc = hereDoc "input.txt" input
52 expectedHereDoc = hereDoc "expected.txt" expected
53 formattedBlock = inputHereDoc ++ expectedHereDoc ++ testExecution cmd id
49 formattedBlock = inputHereDoc ++ testExecution cmd id
5450 in
5551 formattedBlock ++ "\n" ++ formatBlocks rest
5652 formatBlocks (_:rest) =
7268
7369 postlude =
7470 "\n\
75 \\n"
71 \rm -f input.txt output.txt\n"
7672
7773 testExecution cmd id =
7874 cmd ++ " <input.txt >output.txt\n\
79 \diff -q expected.txt output.txt 2>&1 >/dev/null\n\
80 \if [ $? -ne 0 ]\n\
81 \ then\n\
82 \ echo " ++ (show id) ++ "\n\
83 \ echo `wc -l output.txt`\n\
84 \ cat output.txt\n\
85 \fi\n\
86 \rm -f input.txt expected.txt output.txt\n"
75 \echo \"output\"\n\
76 \echo " ++ (show id) ++ "\n\
77 \echo `wc -l output.txt`\n\
78 \cat output.txt\n"