From 140657273b552245fdce3539ef06863423470d0c Mon Sep 17 00:00:00 2001 From: Marc Lasson Date: Wed, 8 May 2019 11:51:30 +0200 Subject: [PATCH] Accept tests --- .../dune-ppx-driver-system/driver-tests/dune | 14 +++++-- .../test-cases/dune-ppx-driver-system/run.t | 38 +++++++++++++++++-- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune b/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune index 0e6e144d85a3..b149437fef13 100644 --- a/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune +++ b/test/blackbox-tests/test-cases/dune-ppx-driver-system/driver-tests/dune @@ -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) @@ -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)) @@ -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}))) @@ -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)) diff --git a/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t b/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t index 957dcfc9e56c..99fba79c75a4 100644 --- a/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t +++ b/test/blackbox-tests/test-cases/dune-ppx-driver-system/run.t @@ -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))) ^^^^^ @@ -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))) ^^^^^^^^^^^^^^^ @@ -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))) ^^^^^^^^^^^^^^^ @@ -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" @@ -44,6 +60,10 @@ 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. @@ -51,6 +71,10 @@ Same, but with error pointing to .ppx $ 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. @@ -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 @@ -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] @@ -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"