Skip to content

Commit

Permalink
Split tests to allow multiple simultaneous jobs.
Browse files Browse the repository at this point in the history
The alias `@all-mdx-tests` runs all the mdx tests.

Signed-off-by: Ulysse Gérard <[email protected]>
  • Loading branch information
voodoos committed Jan 5, 2021
1 parent b02715c commit 5278000
Show file tree
Hide file tree
Showing 56 changed files with 135 additions and 131 deletions.

This file was deleted.

128 changes: 0 additions & 128 deletions test/blackbox-tests/test-cases/mdx-stanza.t/run.t

This file was deleted.

3 changes: 3 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(cram
(applies_to :whole_subtree)
(alias all-mdx-tests))
38 changes: 38 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/lang-version.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
The MDX stanza requires dune lang 2.4 or higher

$ cat >dune-project <<EOF
> (lang dune 2.3)
> (using mdx 0.1)
> EOF

$ dune build @install
File "dune-project", line 2, characters 11-14:
2 | (using mdx 0.1)
^^^
Warning: Version 0.1 of mdx extension to verify code blocks in .md files is
not supported until version 2.4 of the dune language.
There are no supported versions of this extension in version 2.3 of the dune
language.

File "dune", line 1, characters 0-5:
1 | (mdx)
^^^^^
Error: 'mdx' is only available since version 2.4 of the dune language. Please
update your dune-project file to have (lang dune 2.4).
[1]

The version 0.2 requires dune 2.8

$ cat >dune-project <<EOF
> (lang dune 2.7)
> (using mdx 0.2)
> EOF
$ dune build @install
File "dune-project", line 2, characters 11-14:
2 | (using mdx 0.2)
^^^
Error: Version 0.2 of mdx extension to verify code blocks in .md files is not
supported until version 2.8 of the dune language.
Supported versions of this extension in version 2.7 of the dune language:
- 0.1
[1]
24 changes: 24 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/linked-libraries.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Since 0.2 you can use the `libraries` field to have them linked into the test executable

$ cat >dune-project <<EOF
> (lang dune 2.8)
> (using mdx 0.2)
> EOF

$ dune runtest

MDX stanza 0.1 does not support linking libraries

$ cat >dune-project <<EOF
> (lang dune 2.8)
> (using mdx 0.1)
> EOF

$ dune runtest
File "dune", line 3, characters 1-24:
3 | (libraries private_lib))
^^^^^^^^^^^^^^^^^^^^^^^
Error: 'libraries' is only available since version 0.2 of mdx extension to
verify code blocks in .md files. Please update your dune-project file to have
(using mdx 0.2).
[1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Dune does not fail if the `packages` are not available at evaluation time
(regression test fixed by ocaml/dune#3650)

$ dune build -p unrelated-package

Dune fails if the `packages` are not avaliable at execution time

$ dune runtest -p unrelated-package
File "dune", line 3, characters 11-14:
3 | (packages pkg))
^^^
Error: Package pkg does not exist
[1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
You can make local packages available to mdx by using the `packages` field of
the stanza

$ dune runtest
4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/mdx-deps.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Dune should invoke `ocaml-mdx deps` to figure out the files and directories a markdown
or mli to-be-mdxed file depends upon

$ dune runtest
7 changes: 7 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/mdx-simple.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
You can use the mdx stanza to check your documentation in markdown and mli files

$ dune runtest
File "README.md", line 1, characters 0-0:
Error: Files _build/default/README.md and
_build/default/.mdx/README.md.corrected differ.
[1]
30 changes: 30 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/new-deps-field.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Since version 0.2 the mdx stanza supports a more genereic `deps` field.
A deprecation warning is raised if using the olf `packages` field.

$ cat >dune-project <<EOF
> (lang dune 2.8)
> (using mdx 0.2)
> EOF

$ dune runtest
File "dune", line 4, characters 1-15:
4 | (packages pkg))
^^^^^^^^^^^^^^
Warning: 'packages' was deprecated in version 0.2 of mdx extension to verify
code blocks in .md files.

But using the new field with the old stanza would fail

$ cat >dune-project <<EOF
> (lang dune 2.8)
> (using mdx 0.1)
> EOF

$ dune runtest
File "dune", line 3, characters 1-22:
3 | (deps (package pkg2))
^^^^^^^^^^^^^^^^^^^^^
Error: 'deps' is only available since version 0.2 of mdx extension to verify
code blocks in .md files. Please update your dune-project file to have (using
mdx 0.2).
[1]
3 changes: 3 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/preludes.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
You can set MDX preludes using the preludes field of the stanza

$ dune runtest
9 changes: 9 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/using-mdx.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$ cat >dune-project <<EOF
> (lang dune 2.4)
> EOF

To use the mdx stanza you need to explicitly set (using mdx ..) in the
dune-project

$ dune build @install
Info: Appending this line to dune-project: (using mdx 0.1)

0 comments on commit 5278000

Please sign in to comment.