Skip to content

Commit e1d73b3

Browse files
committed
Expect tests: support multiple modes
Each mode must correspond to a different output file. Signed-off-by: Jérôme Vouillon <[email protected]>
1 parent 34497af commit e1d73b3

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/dune_rules/test_rules.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
open Import
22

33
let rules (t : Tests.t) ~sctx ~dir ~scope ~expander ~dir_contents =
4-
let test_kind (loc, name) =
4+
let test_kind (loc, name, ext) =
55
let files = Dir_contents.text_files dir_contents in
66
let expected_basename = name ^ ".expected" in
77
if Filename.Set.mem files expected_basename
88
then
99
`Expect
1010
{ Diff.file1 = String_with_vars.make_text loc expected_basename
11-
; file2 = String_with_vars.make_text loc (name ^ ".output")
11+
; file2 = String_with_vars.make_text loc (name ^ ext ^ ".output")
1212
; optional = false
1313
; mode = Text
1414
}
@@ -91,7 +91,7 @@ let rules (t : Tests.t) ~sctx ~dir ~scope ~expander ~dir_contents =
9191
in
9292
Simple_rules.alias sctx ~extra_bindings ~dir ~expander alias
9393
in
94-
match test_kind (loc, s) with
94+
match test_kind (loc, s, ext) with
9595
| `Regular -> add_alias ~loc ~action:run_action ~locks:[]
9696
| `Expect diff ->
9797
let rule =
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
$ dune runtest
2-
Error: Multiple rules generated for _build/default/modes.output:
3-
- dune:1
4-
- dune:1
5-
[1]

0 commit comments

Comments
 (0)