Skip to content

Commit

Permalink
move to dune 2.0 and manual qtest
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Feb 18, 2022
1 parent e0771d8 commit a1296c8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

(alias
(name runtest)
(rule
(alias runtest)
(deps (:readme README.md))
(action (progn
(run mdx test %{readme})
(run ocaml-mdx test %{readme})
(diff? %{readme} %{readme}.corrected))))

2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(lang dune 1.1)
(lang dune 2.0)
2 changes: 1 addition & 1 deletion lwt-pipe.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build: [
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
depends: [
"dune" {>= "1.1"}
"dune" {>= "2.0"}
"lwt"
"ocaml" { >= "4.03.0" }
"mdx" {with-test}
Expand Down
17 changes: 17 additions & 0 deletions qtest/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

DONTTEST=
QTESTABLE=$(filter-out $(DONTTEST), \
$(wildcard ../src/*.ml) \
$(wildcard ../src/*.mli) \
)

qtest-gen:
@rm run_qtest.ml 2>/dev/null || true
@if which qtest > /dev/null ; then \
qtest extract \
-o run_qtest.ml \
$(QTESTABLE) 2> /dev/null ; \
else touch run_qtest.ml ; \
fi

.PHONY: qtest-gen
17 changes: 17 additions & 0 deletions qtest/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

(rule
(targets run_qtest.ml)
(deps Makefile (source_tree ../src)) ; (glob_files ../src/**/*.ml{,i})))
(mode fallback)
(action (run make qtest-gen)))

(executable
(name run_qtest)
(flags :standard -warn-error -a+8 -safe-string -w -33)
(libraries lwt-pipe qcheck))

(rule
(alias runtest)
(deps (:bin run_qtest.exe))
(action (run %{bin})))

3 changes: 1 addition & 2 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
(public_name lwt-pipe)
(wrapped false)
(libraries lwt lwt.unix)
(inline_tests (backend qtest.lib))
(flags :standard -w +a-4 -safe-string))
(flags :standard -w +a-4 -warn-error -a+8 -safe-string))

0 comments on commit a1296c8

Please sign in to comment.