Skip to content

Commit

Permalink
Accept tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlasson committed May 8, 2019
1 parent fc25cb6 commit 1406572
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
(modules ())
(libraries driver2))

; Forbidden equal sign
(library
(name ppx5)
(public_name foo.ppx5)
(kind (ppx_rewriter (cookies (= "equal sign"))))
(modules ())
(libraries driver2))

(library
(name driver1)
(public_name foo.driver1)
Expand Down Expand Up @@ -87,7 +95,7 @@
(library
(name ppx_with_cookies_print_args)
(kind (ppx_rewriter
(cookies (italy "%{env:ITALY=undefined}")
(cookies (italy "%{env:ITALY=undefined}")
(france "%{env:FRANCE=undefined}"))))
(modules ())
(libraries driver_print_args))
Expand All @@ -97,7 +105,7 @@
(library
(name test_ppx_args)
(modules test_ppx_args)
(preprocess
(preprocess
(pps -arg1 driver_print_args ppx_with_cookies_print_args -arg2 -arg3=%{env:AMERICA=undefined} --
-foo bar %{env:ENGLAND=undefined})))

Expand All @@ -117,7 +125,7 @@
(library
(name ppx_with_cookies_print_tool)
(kind (ppx_rewriter
(cookies (italy "%{env:ITALY=undefined}")
(cookies (italy "%{env:ITALY=undefined}")
(france "%{env:FRANCE=undefined}"))))
(modules ())
(libraries driver_print_tool))
Expand Down
38 changes: 35 additions & 3 deletions test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ No ppx driver found

$ dune build --root driver-tests foo1.cma
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
File "dune", line 6, characters 13-18:
6 | (preprocess (pps)))
^^^^^
Expand All @@ -12,6 +16,10 @@ Too many drivers

$ dune build --root driver-tests foo2.cma
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
File "dune", line 13, characters 13-28:
13 | (preprocess (pps ppx1 ppx2)))
^^^^^^^^^^^^^^^
Expand All @@ -23,6 +31,10 @@ Not compatible with Dune

$ dune build --root driver-tests foo3.cma
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
File "dune", line 20, characters 13-28:
20 | (preprocess (pps ppx_other)))
^^^^^^^^^^^^^^^
Expand All @@ -35,6 +47,10 @@ Incompatible Cookies

$ dune build --root driver-tests foo4.cma
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
Error: foo.ppx3 and foo.ppx4 have inconsistent requests for cookie "germany";
foo.ppx3 requests "spritzgeback" and foo.ppx4 requests
"lebkuchen"
Expand All @@ -44,13 +60,21 @@ Same, but with error pointing to .ppx

$ dune build --root driver-tests .ppx/foo.ppx1+foo.ppx2/ppx.exe
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
File "_build/default/.ppx/foo.ppx1+foo.ppx2/ppx.exe", line 1, characters 0-0:
Error: Failed to create on-demand ppx rewriter for foo.ppx1 and foo.ppx2; too
many incompatible ppx drivers were found: foo.driver2 and foo.driver1.
[1]

$ dune build --root driver-tests .ppx/foo.ppx-other/ppx.exe
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
File "_build/default/.ppx/foo.ppx-other/ppx.exe", line 1, characters 0-0:
Error: Failed to create on-demand ppx rewriter for foo.ppx-other; no ppx
driver were found. It seems that foo.ppx-other is not compatible with Dune.
Expand All @@ -62,6 +86,10 @@ Test the argument syntax

$ dune build --root driver-tests test_ppx_args.cma
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
ppx test_ppx_args.pp.ml
.ppx/fb8f5a35329c41c0aef8d783a2c365db/ppx.exe
-arg1
Expand All @@ -81,9 +109,9 @@ Test the argument syntax
--impl
test_ppx_args.ml
--as-ppx
File "dune", line 101, characters 3-138:
101 | (pps -arg1 driver_print_args ppx_with_cookies_print_args -arg2 -arg3=%{env:AMERICA=undefined} --
102 | -foo bar %{env:ENGLAND=undefined})))
File "dune", line 109, characters 3-138:
109 | (pps -arg1 driver_print_args ppx_with_cookies_print_args -arg2 -arg3=%{env:AMERICA=undefined} --
110 | -foo bar %{env:ENGLAND=undefined})))
Error: rule failed to generate the following targets:
- test_ppx_args.pp.ml
[1]
Expand All @@ -92,6 +120,10 @@ Test that going throught the -ppx option of the compiler works

$ dune build --root driver-tests test_ppx_staged.cma
Entering directory 'driver-tests'
File "dune", line 66, characters 31-47:
66 | (kind (ppx_rewriter (cookies (= "equal sign"))))
^^^^^^^^^^^^^^^^
Warning: Cookie names should not contain the '=' character
ocamldep .test_ppx_staged.objs/test_ppx_staged.ml.d
tool name: ocamldep
args:--as-ppx -arg1 -arg2 -arg3=Oreo -foo bar Snickerdoodle --cookie france="Petit Beurre" --cookie italy="Biscotti" --cookie library_name="test_ppx_staged"
Expand Down

0 comments on commit 1406572

Please sign in to comment.