Add tests for meta generation (#344)

Try to test as many aspects as possible: dependencies, synopsis, ppx, etc.
This commit is contained in:
Rudi Grinberg 2017-11-29 16:22:37 +08:00 committed by GitHub
parent 785beeafac
commit 9983b3e7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 0 deletions

View File

@ -84,4 +84,11 @@
(deps ((files_recursively_in test-cases/force-test)))
(action
(chdir test-cases/force-test
(setenv JBUILDER ${bin:jbuilder} (run ${exe:cram.exe} run.t))))))
(alias
((name runtest)
(deps ((files_recursively_in test-cases/meta-gen)))
(action
(chdir test-cases/meta-gen
(setenv JBUILDER ${bin:jbuilder} (run ${exe:cram.exe} run.t))))))

View File

@ -0,0 +1,27 @@
(jbuild_version 1)
(library
((name foobar)
(libraries (bytes))
(public_name foobar)
(synopsis "contains \"quotes\"")))
(library
((name foobar_baz)
(public_name foobar.baz)
(libraries (bytes))
(modes (byte))
(synopsis "sub library with modes set to byte")))
(library
((name foobar_rewriter)
(synopsis "ppx rewriter")
(libraries (foobar))
(public_name foobar.rewriter)
(ppx_runtime_libraries (foobar_baz))
(kind ppx_rewriter)))
(alias
((name runtest)
(deps (META.foobar))
(action (echo "${read:META.foobar}"))))

View File

@ -0,0 +1,32 @@
$ $JBUILDER runtest --force -j1 --root .
description = "contains \"quotes\""
requires = "bytes"
archive(byte) = "foobar.cma"
archive(native) = "foobar.cmxa"
plugin(byte) = "foobar.cma"
plugin(native) = "foobar.cmxs"
package "baz" (
directory = "baz"
description = "sub library with modes set to byte"
requires = "bytes"
archive(byte) = "foobar_baz.cma"
archive(native) = "foobar_baz.cmxa"
plugin(byte) = "foobar_baz.cma"
plugin(native) = "foobar_baz.cmxs"
)
package "rewriter" (
directory = "rewriter"
description = "ppx rewriter"
requires(ppx_driver) = "bytes foobar"
archive(ppx_driver,byte) = "foobar_rewriter.cma"
archive(ppx_driver,native) = "foobar_rewriter.cmxa"
plugin(ppx_driver,byte) = "foobar_rewriter.cma"
plugin(ppx_driver,native) = "foobar_rewriter.cmxs"
# This is what jbuilder uses to find out the runtime dependencies of
# a preprocessor
ppx_runtime_deps = "bytes foobar.baz"
# This line makes things transparent for people mixing preprocessors
# and normal dependencies
requires(-ppx_driver) = "bytes foobar.baz"
ppx(-ppx_driver,-custom_ppx) = "./ppx.exe --as-ppx"
)