| Revision 1,
880 bytes
checked in by gnue, 7 years ago
(diff) |
|
import project
|
| Line | |
|---|
| 1 | #!newt |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | local testFiles := [ |
|---|
| 5 | {file: "easter.newt", newline: true}, |
|---|
| 6 | {file: "fib.newt", success: 17711, newline: true}, |
|---|
| 7 | {file: "regex.newt", success: "123;foo"}, |
|---|
| 8 | ]; |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | local testResults := []; |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | foreach v in testFiles do |
|---|
| 15 | begin |
|---|
| 16 | print(paramStr("*** \"^0\" start...", [v.file])); |
|---|
| 17 | if v.newline then print("\n"); |
|---|
| 18 | |
|---|
| 19 | try |
|---|
| 20 | result := load(v.file); |
|---|
| 21 | |
|---|
| 22 | if v.success then |
|---|
| 23 | result := v.success == result; |
|---|
| 24 | onexception |evt.ex| do begin |
|---|
| 25 | print("*** exception "); |
|---|
| 26 | p(CurrentException()); |
|---|
| 27 | result := nil; |
|---|
| 28 | end; |
|---|
| 29 | |
|---|
| 30 | okStr := if result then "OK" else "NG"; |
|---|
| 31 | |
|---|
| 32 | if v.newline then |
|---|
| 33 | print(paramStr("*** \"^0\" done (^1)\n\n", [v.file, okStr])) |
|---|
| 34 | else |
|---|
| 35 | print(paramStr("done (^0)\n", [okStr])); |
|---|
| 36 | |
|---|
| 37 | AddArraySlot(testResults, {file: v.file, result: result}); |
|---|
| 38 | end; |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | foreach v in testResults do |
|---|
| 42 | begin |
|---|
| 43 | okStr := if v.result then "OK" else "NG"; |
|---|
| 44 | print(paramStr(" ^0 ==> ^1\n", [v.file, okStr])); |
|---|
| 45 | end; |
|---|
Note: See
TracBrowser
for help on using the repository browser.