1open testutils
2
3infix ++
4val op++ = OS.Path.concat
5
6val hm = Globals.HOLDIR ++ "bin" ++ "Holmake"
7
8fun inDir d f x =
9    let
10      val d0 = OS.FileSys.getDir ()
11      val _ = OS.FileSys.chDir d handle _ => die ("Bad dir "^d)
12      val res = Exn.capture f x
13    in
14      OS.FileSys.chDir d0;
15      Exn.release res
16    end
17
18fun okres _ (Mosml.Success s) = false
19  | okres i (Mosml.Failure s) = String.isSubstring i s
20
21fun pResult (Mosml.Success s) = "Succeeded with: \"" ^ String.toString s ^ "\""
22  | pResult (Mosml.Failure s) = "Failed with: \"" ^ String.toString s ^ "\""
23
24fun t msg args = (
25  tprint msg;
26  require_msg (check_result (okres "dir2")) pResult (Mosml.run hm args) ""
27)
28
29val _ = inDir "dir1" (t "Bad INCLUDES line in a Holmakefile") []
30val _ = inDir "dir3" (t "Bad -I line in c/line to Holmake") ["-I", "../dir2"]
31