Add tests

The symptoms are a bit different depending on the presence of an
interface file.
This commit is contained in:
Etienne Millon 2018-04-03 10:25:31 +02:00 committed by Jérémie Dimino
parent 5d9a99d28b
commit 0cf8a8240a
12 changed files with 60 additions and 0 deletions

View File

@ -489,3 +489,13 @@
(progn
(run ${exe:cram.exe} run.t)
(diff? run.t run.t.corrected))))))
(alias
((name runtest)
(deps ((package jbuilder)
(files_recursively_in test-cases/github660)))
(action
(chdir test-cases/github660
(progn
(run ${exe:cram.exe} run.t)
(diff? run.t run.t.corrected))))))

View File

@ -0,0 +1,8 @@
(jbuild_version 1)
(alias
((name runtest)
(deps (main.exe))
(action (run ${<}))))
(executable ((name main)))

View File

@ -0,0 +1 @@
module Sub = Lib_sub

View File

@ -0,0 +1 @@
module Sub = Lib_sub

View File

@ -0,0 +1 @@
let hello = "hello"

View File

@ -0,0 +1 @@
val hello : string

View File

@ -0,0 +1,3 @@
let () =
print_endline Lib.Sub.hello;
()

View File

@ -0,0 +1,8 @@
(jbuild_version 1)
(alias
((name runtest)
(deps (main.exe))
(action (run ${<}))))
(executable ((name main)))

View File

@ -0,0 +1 @@
module Sub = Lib_sub

View File

@ -0,0 +1 @@
let hello = "hello"

View File

@ -0,0 +1,3 @@
let () =
print_endline Lib.Sub.hello;
()

View File

@ -0,0 +1,22 @@
When there are explicit interfaces, modules must be rebuilt.
$ jbuilder runtest --root explicit-interfaces --display quiet -j1 2>&1 | grep -v Entering
main alias runtest
hello
$ echo 'let x = 1' >> explicit-interfaces/lib_sub.ml
$ jbuilder runtest --root explicit-interfaces --display quiet -j1 2>&1 | grep -v Entering | grep -v ocamlopt
File "_none_", line 1:
Error: Files .main.eobjs/main.cmx and .main.eobjs/lib_sub.cmx
make inconsistent assumptions over implementation Lib_sub
When there are no interfaces, the situation is the same, but it is not possible
to rely on these.
$ jbuilder runtest --root no-interfaces --display quiet -j1 2>&1 | grep -v Entering
main alias runtest
hello
$ echo 'let x = 1' >> no-interfaces/lib_sub.ml
$ jbuilder runtest --root no-interfaces --display quiet -j1 2>&1 | grep -v Entering | grep -v ocamlopt
File "_none_", line 1:
Error: Files .main.eobjs/main.cmx and .main.eobjs/lib_sub.cmx
make inconsistent assumptions over interface Lib_sub