Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Sep 28, 2021
1 parent 5950948 commit 4df7a1a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/bin/misc-test-cases/mdx-jupyter/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(rule
(targets test.jpynb)
(deps
(:x test.md)
(package mdx))
(action
(with-stdout-to
%{targets}
(run %{bin:ocaml-mdx} jupyter %{x}))))

(rule
(alias runtest)
(deps
(:x test.jpynb)
(:y test.jpynb.expected))
(action
(diff? %{y} %{x})))
1 change: 1 addition & 0 deletions test/bin/misc-test-cases/mdx-jupyter/test.jpynb.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"metadata":{"kernelspec":{"display_name":"OCaml 4.07.1","language":"OCaml","name":"ocaml-jupyter"},"language_info":{"name":"OCaml","version":"4.07.1","codemirror_mode":"text/x-ocaml","file_extension":".ml","mimetype":"text/x-ocaml","nbconverter_exporter":null,"pygments_lexer":"OCaml"}},"nbformat":4,"nbformat_minor":2,"cells":[{"cell_type":"markdown","metadata":{},"source":"## Generating a Jupyter notebook\n\n\n"},{"cell_type":"code","metadata":{},"source":"let x = 1\nlet () = assert true","outputs":[],"execution_count":1},{"cell_type":"markdown","metadata":{},"source":"\nThis block should not be executed by the tests:"},{"cell_type":"code","metadata":{},"source":"let x = 2\nlet () = assert false (* Don't print this! *)","outputs":[],"execution_count":2},{"cell_type":"code","metadata":{},"source":"let () = print_int x","outputs":[],"execution_count":3}]}
16 changes: 16 additions & 0 deletions test/bin/misc-test-cases/mdx-jupyter/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Generating a Jupyter notebook

```ocaml
let x = 1
let () = assert true
```

This block should not be executed by the tests:
```ocaml skip
let x = 2
let () = assert false (* Don't print this! *)
```

```ocaml
let () = print_int x
```

0 comments on commit 4df7a1a

Please sign in to comment.