Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / regression / cmdline.sml
1 (* Auxiliary functions for test cases *)
2
3 infix 1 seq
4 fun e1 seq e2 = e2;
5 fun check b = if b then "OK" else "WRONG";
6 fun check' f = (if f () then "OK" else "WRONG") handle _ => "EXN";
7
8 fun 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
14 fun checkrange bounds = check o range bounds;
15
16 fun tst0 s s' = print (s ^ " \t" ^ s' ^ "\n");
17 fun tst s b = tst0 s (check b);
18 fun tst' s f = tst0 s (check' f);
19
20 fun tstrange s bounds = (tst s) o range bounds
21
22 (* test/cmdline.sml, PS 1997-03-07 *)
23
24 val _ =
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 ()))