summaryrefslogtreecommitdiff
path: root/testsuite/tests/opaque/test.ml
blob: 4af63ede528a09048424abcd2b761b382ea5b510 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(* TEST

subdirectories = "fst intf snd"

compile_only = "true"

* setup-ocamlopt.byte-build-env
** ocamlopt.byte
flags = "-I intf -opaque"
all_modules = "intf/opaque_intf.mli"
*** ocamlopt.byte
flags = "-I intf"
all_modules = "intf/opaque_impl.mli intf/regular.mli"
**** copy
src = "intf/opaque_intf.cmi intf/opaque_impl.cmi intf/regular.cmi \
       intf/opaque_intf.mli intf/opaque_impl.mli intf/regular.mli"
dst = "fst/"
***** copy
src = "intf/opaque_intf.cmi intf/opaque_impl.cmi intf/regular.cmi \
       intf/opaque_intf.mli intf/opaque_impl.mli intf/regular.mli"
dst = "snd/"
****** ocamlopt.byte
flags = "-I fst -opaque"
all_modules = "fst/opaque_impl.ml"
******* ocamlopt.byte
flags = "-I snd -opaque"
all_modules = "snd/opaque_impl.ml"
******** ocamlopt.byte
flags = "-I fst"
all_modules = "fst/opaque_intf.ml fst/regular.ml"
********* ocamlopt.byte
flags = "-I snd"
all_modules = "snd/opaque_intf.ml snd/regular.ml"
********** ocamlopt.byte
flags = "-I fst"
all_modules = "test.ml"

(* ordinary compilation *)
*********** ocamlopt.byte
compile_only = "false"
all_modules = "fst/opaque_intf.cmx fst/opaque_impl.cmx fst/regular.cmx test.cmx"
program = "${test_build_directory}/p1.exe"

(* change to opaque interface *)
*********** ocamlopt.byte
compile_only = "false"
all_modules = "snd/opaque_intf.cmx fst/opaque_impl.cmx fst/regular.cmx test.cmx"
program = "${test_build_directory}/p2.exe"

(* change to opaque implementation *)
*********** ocamlopt.byte
compile_only = "false"
all_modules = "fst/opaque_intf.cmx snd/opaque_impl.cmx fst/regular.cmx test.cmx"
program = "${test_build_directory}/p3.exe"

(* change to non-opaque implementation *)
*********** ocamlopt.byte
compile_only = "false"
all_modules = "fst/opaque_intf.cmx fst/opaque_impl.cmx snd/regular.cmx test.cmx"
program = "${test_build_directory}/p4.exe"
ocamlopt_byte_exit_status = "2"

*)

let () =
  print_endline (Opaque_intf.choose "Opaque_intf: First" "Opaque_intf: Second")

let () =
  print_endline (Opaque_impl.choose "Opaque_impl: First" "Opaque_impl: Second")

let () =
  print_endline (Regular.choose "Regular: First" "Regular: Second")