Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | val tests = [ |
2 | "\"hello\\\"", | |
3 | "c:\\foo.bah", | |
4 | "", | |
5 | "hi\\", | |
6 | "hi\"", | |
7 | "evil\narg", | |
8 | "evil\targ", | |
9 | "evil arg", | |
10 | "evil\rarg", | |
11 | "evil\farg", | |
12 | "\"bar\\", | |
13 | "\\bah", | |
14 | "bah \\bar", | |
15 | "bah\\bar", | |
16 | "bah\\\\", | |
17 | "ba h\\\\", | |
18 | "holy\"smoke", | |
19 | "holy \"smoke" ] | |
20 | ||
21 | val cmd = CommandLine.name () | |
22 | val args = CommandLine.arguments () | |
23 | ||
24 | fun loop ([], []) = print "OK!\n" | |
25 | | loop (x::r, y::s) = | |
26 | (if x <> y then print ("FAIL: "^x^":"^y^"\n") else (); loop (r, s)) | |
27 | | loop (_, _) = print "Wrong argument count\n" | |
28 | ||
29 | open MLton.Process | |
30 | val () = | |
31 | if List.length args = 0 | |
32 | then let | |
33 | val pid = | |
34 | create {args = (*cmd::*)tests, | |
35 | env = NONE, | |
36 | path = cmd, | |
37 | stderr = Param.self, | |
38 | stdin = Param.self, | |
39 | stdout = Param.self} | |
40 | val status = reap pid | |
41 | in | |
42 | () | |
43 | end | |
44 | else loop (tests, args) |