Add a test with (preprocess (action ...))

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-07-09 17:17:49 +01:00 committed by Rudi Grinberg
parent 015b317f43
commit fa0ab5b4a4
11 changed files with 46 additions and 0 deletions

View File

@ -539,6 +539,14 @@
(run %{exe:cram.exe} -skip-versions 4.02.3 -test run.t)
(diff? run.t run.t.corrected)))))
(alias
(name preprocess-with-action)
(deps (package dune) (source_tree test-cases/preprocess-with-action))
(action
(chdir
test-cases/preprocess-with-action
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
(alias
(name private-public-overlap)
(deps (package dune) (source_tree test-cases/private-public-overlap))
@ -749,6 +757,7 @@
(alias package-dep)
(alias path-variables)
(alias ppx-rewriter)
(alias preprocess-with-action)
(alias private-public-overlap)
(alias project-root)
(alias promote)
@ -826,6 +835,7 @@
(alias output-obj)
(alias package-dep)
(alias path-variables)
(alias preprocess-with-action)
(alias project-root)
(alias promote)
(alias quoting)

View File

@ -0,0 +1 @@
(lang dune 1.0)

View File

@ -0,0 +1,3 @@
(test
(name test)
(preprocess (action (run pp/pp.exe %{first-dep}))))

View File

@ -0,0 +1 @@
Hello, world!

View File

@ -0,0 +1 @@
print_endline _STRING_

View File

@ -0,0 +1,10 @@
(executable
((name test)
(preprocess (action (run pp/pp.exe ${<})))))
(rule
(with-stdout-to test.output (run ./test.exe)))
(alias
((name runtest)
(action (diff test.expected test.output))))

View File

@ -0,0 +1 @@
Hello, world!

View File

@ -0,0 +1 @@
print_endline _STRING_

View File

@ -0,0 +1,4 @@
(executable
(name pp))
(ocamllex pp)

View File

@ -0,0 +1,10 @@
rule main = parse
| eof { () }
| "_STRING_" { Printf.printf "%S" "Hello, world!"; main lexbuf }
| _ as c { print_char c; main lexbuf }
{
let () =
set_binary_mode_out stdout true;
main (Lexing.from_channel (open_in_bin Sys.argv.(1)))
}

View File

@ -0,0 +1,4 @@
$ dune runtest
File "dune/dune", line 3, characters 38-48:
Error: unknown variable "first-dep"
[1]