-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathinstallation_test.ml
38 lines (32 loc) · 1.04 KB
/
installation_test.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
let suites : Mt.pair_suites ref = ref []
let test_id = ref 0
let eq loc x y =
incr test_id ;
suites :=
(loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites
let () =
match [%node __dirname] with | Some p ->
let root = App_root_finder.find_package_json p in
let bsc_exe =
Node.Path.join
[| root ; "jscomp"; "bin"; "bsc.exe" |] in
begin match Node.Child_process.execSync
(bsc_exe ^ " -where ")
(Node.Child_process.option ~encoding:"utf8" ()) with
| output ->
let dir = Js.String.trim output in
let files = Node.Fs.readdirSync dir in
let exists =
files
|> Js.Array.indexOf "pervasives.cmi" in
let non_exists =
files
|> Js.Array.indexOf "pervasive.cmi" in
let v = (exists >= 0 && non_exists < 0) in
Js.log v;
| exception e ->
assert false
end
| None -> assert false
let () =
Mt.from_pair_suites __FILE__ !suites