Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / regression / cmdline.sml
CommitLineData
7f918cf1
CE
1(* Auxiliary functions for test cases *)
2
3infix 1 seq
4fun e1 seq e2 = e2;
5fun check b = if b then "OK" else "WRONG";
6fun check' f = (if f () then "OK" else "WRONG") handle _ => "EXN";
7
8fun range (from, to) p =
9 let open Int
10 in
11 (from > to) orelse (p from) andalso (range (from+1, to) p)
12 end;
13
14fun checkrange bounds = check o range bounds;
15
16fun tst0 s s' = print (s ^ " \t" ^ s' ^ "\n");
17fun tst s b = tst0 s (check b);
18fun tst' s f = tst0 s (check' f);
19
20fun tstrange s bounds = (tst s) o range bounds
21
22(* test/cmdline.sml, PS 1997-03-07 *)
23
24val _ =
25 (app print ["This program is invoked as `", CommandLine.name(), "'\n",
26 "with arguments:\n"];
27 app (fn a => (print a; print "\n")) (CommandLine.arguments ()))