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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
(* TEST
(* This tests the -H flag.
The basic structure is that libc depends on libb, which depends on liba. We
want to test a few things:
- Compiling libc with -I liba allows the compiler to see the type definitions
in liba and allows c.ml to reference it directly.
- Compiling libc with -H liba allows the compiler to see the type definitions
in liba, but doesn't allow c.ml to reference it directly.
- If -H and -I are are passed for two different versions of liba, the -I one
takes priority.
- If -H is passed twice with two different versions of liba, the first takes
priority.
The liba_alt directory has an alternate versions of liba used for testing the
precedence order of the includes.
*)
subdirectories = "liba liba_alt libb libc";
setup-ocamlc.byte-build-env;
flags = "-I liba -nocwd";
module = "liba/a.ml";
ocamlc.byte;
flags = "-I liba_alt -nocwd";
module = "liba_alt/a.ml";
ocamlc.byte;
flags = "-I liba -I libb -nocwd";
module = "libb/b.ml";
ocamlc.byte;
{
(* Test hiding A completely *)
flags = "-I libb -nocwd";
module = "libc/c2.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
{
(* Test hiding A completely, but using it *)
flags = "-I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc_byte_exit_status = "2";
ocamlc.byte;
compiler_reference = "${test_source_directory}/not_included.ocamlc.reference";
check-ocamlc.byte-output;
}
{
(* Test transitive use of A's cmi with -I. *)
flags = "-I liba -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
{
(* Test transitive use of A's cmi with -H. *)
flags = "-H liba -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
{
(* Test direct use of A cmi with -H. *)
flags = "-H liba -I libb -nocwd";
module = "libc/c3.ml";
setup-ocamlc.byte-build-env;
ocamlc_byte_exit_status = "2";
ocamlc.byte;
compiler_reference =
"${test_source_directory}/cant_reference_hidden.ocamlc.reference";
check-ocamlc.byte-output;
}
(* The next four tests check that -I takes priority over -H regardless of the
order on the command line.
*)
{
flags = "-H liba_alt -I liba -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
{
flags = "-I liba -H liba_alt -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
{
not-windows;
flags = "-H liba -I liba_alt -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc_byte_exit_status = "2";
ocamlc.byte;
compiler_reference =
"${test_source_directory}/wrong_include_order.ocamlc.reference";
check-ocamlc.byte-output;
}
{
not-windows;
flags = "-I liba_alt -H liba -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc_byte_exit_status = "2";
ocamlc.byte;
compiler_reference =
"${test_source_directory}/wrong_include_order.ocamlc.reference";
check-ocamlc.byte-output;
}
(* The next two tests show that earlier -Hs take priority over later -Hs *)
{
not-windows;
flags = "-H liba_alt -H liba -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc_byte_exit_status = "2";
ocamlc.byte;
compiler_reference =
"${test_source_directory}/wrong_include_order.ocamlc.reference";
check-ocamlc.byte-output;
}
{
flags = "-H liba -H liba_alt -I libb -nocwd";
module = "libc/c1.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
(* Test that a hidden `A` doesn't become visible as a result of the typechecker
using it. *)
{
flags = "-H liba -I libb -nocwd";
module = "libc/c4.ml";
setup-ocamlc.byte-build-env;
ocamlc_byte_exit_status = "2";
ocamlc.byte;
compiler_reference =
"${test_source_directory}/hidden_stays_hidden.ocamlc.reference";
check-ocamlc.byte-output;
}
(* Test that type-directed constructor disambiguation works through -H (at
least, for now). *)
{
flags = "-H liba -I libb -nocwd";
module = "libc/c5.ml";
setup-ocamlc.byte-build-env;
ocamlc.byte;
}
*)
|