Add blackbox test for select construct (#363)

This commit is contained in:
Rudi Grinberg 2017-12-13 14:34:35 +08:00 committed by GitHub
parent 2cab60b150
commit b7dd41fc6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 0 deletions

View File

@ -128,3 +128,9 @@
(chdir test-cases/odoc
(setenv JBUILDER ${bin:jbuilder} (run ${exe:cram.exe} -ocamlv ${ocaml_version} -skip-versions 4.02.3 run.t))))))
(alias
((name runtest)
(deps ((files_recursively_in test-cases/select)))
(action
(chdir test-cases/select
(setenv JBUILDER ${bin:jbuilder} (run ${exe:cram.exe} run.t))))))

View File

@ -0,0 +1 @@
let message = "bar has no unix"

View File

@ -0,0 +1 @@
let message = "bar has unix"

View File

@ -0,0 +1 @@
let message = "foo has fake"

View File

@ -0,0 +1 @@
let message = "foo has no fake"

View File

@ -0,0 +1,16 @@
(jbuild_version 1)
(executable
((name main)
(libraries
((select bar.ml from
(unix -> bar_unix.ml)
(!unix -> bar_no_unix.ml))
(select foo.ml from
(fakefoobar -> foo_fake.ml)
(!fakefoobar -> foo_no_fake.ml))))))
(alias
((name runtest)
(deps (main.exe))
(action (run ${<}))))

View File

@ -0,0 +1,2 @@
print_endline Bar.message;;
print_endline Foo.message;;

View File

@ -0,0 +1,12 @@
$ $JBUILDER runtest -j1 --root .
ocamldep main.depends.ocamldep-output
ocamlc bar.{cmi,cmo,cmt}
ocamlc foo.{cmi,cmo,cmt}
ocamlopt bar.{cmx,o}
ocamlopt foo.{cmx,o}
ocamlc main.{cmi,cmo,cmt}
ocamlopt main.{cmx,o}
ocamlopt main.exe
main alias runtest
bar has unix
foo has no fake