File tree Expand file tree Collapse file tree 3 files changed +88
-0
lines changed
test/bin/mdx-dune-gen/misc/non-deterministic Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1+ (rule
2+ (target dune_gen.ml)
3+ (action
4+ (with-stdout-to
5+ %{target}
6+ (run ocaml-mdx dune-gen))))
7+
8+ (executable
9+ (name dune_gen)
10+ (modules dune_gen)
11+ (modes byte)
12+ (libraries mdx.test))
13+
14+ (rule
15+ (target dune-mdx-nondeterministic.deterministic)
16+ (deps
17+ dune_gen.exe
18+ (:input dune-mdx-nondeterministic))
19+ (action
20+ (with-stdout-to
21+ %{target}
22+ (run ./dune_gen.exe %{input}))))
23+
24+ (rule
25+ (target dune-mdx-nondeterministic.nondeterministic)
26+ (deps
27+ dune_gen.exe
28+ (:input dune-mdx-nondeterministic))
29+ (action
30+ (setenv
31+ MDX_RUN_NON_DETERMINISTIC
32+ 1
33+ (with-stdout-to
34+ %{target}
35+ (run ./dune_gen.exe %{input})))))
36+
37+ (rule
38+ (alias runtest)
39+ (action
40+ (diff %{dep:dune-mdx-nondeterministic.expected}
41+ %{dep:dune-mdx-nondeterministic.deterministic})))
42+
43+ ;; make sure the non-deterministic is different from the deterministic
44+
45+ (rule
46+ (alias runtest)
47+ (action
48+ (with-accepted-exit-codes
49+ 1
50+ (ignore-stdout
51+ (run diff %{dep:dune-mdx-nondeterministic.expected}
52+ %{dep:dune-mdx-nondeterministic.nondeterministic})))))
Original file line number Diff line number Diff line change 1+ This test checks whether the non-deterministic mode works with the `dune` `mdx`
2+ stanza.
3+
4+ Deterministic stanzas should get run and corrected, as for 1 plus one is not 3:
5+
6+ ```ocaml
7+ # 1 + 1;;
8+ - : int = 42
9+ ```
10+
11+ Non-deterministic ones should not be updated, since whatever `Random` outputs
12+ should be random:
13+
14+ <!-- $MDX non-deterministic=command -->
15+ ```ocaml
16+ # Random.int 1000;;
17+ - : int = 42
18+ ```
Original file line number Diff line number Diff line change 1+ This test checks whether the non-deterministic mode works with the `dune` `mdx`
2+ stanza.
3+
4+ Deterministic stanzas should get run and corrected, as for 1 plus one is not 3:
5+
6+ ```ocaml
7+ # 1 + 1;;
8+ - : int = 2
9+ ```
10+
11+ Non-deterministic ones should not be updated, since whatever `Random` outputs
12+ should be random:
13+
14+ <!-- $MDX non-deterministic=command -->
15+ ```ocaml
16+ # Random.int 1000;;
17+ - : int = 42
18+ ```
You can’t perform that action at this time.
0 commit comments