From afe1c3f579143d68fa959f958dd315d61c5b64dd Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 27 Dec 2024 12:33:53 +0100 Subject: [PATCH 1/4] Clean up installation instructions --- README.adoc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index 35bddef4..bff44817 100644 --- a/README.adoc +++ b/README.adoc @@ -34,14 +34,22 @@ changed in lots of small ways (in the right direction, I hope) so the code will not work any more. <> is an updated version of the blog post's examples. -== Build +== Build and Install - $ make - -You can use opam: +You can install qcheck via opam: $ opam install qcheck +The `qcheck` package is offered for compatibility. +For a bare-bones installation you can use the `qcheck-core` package: + + $ opam install qcheck-core + +To build the library from source + + $ make + + == License The code is now released under the BSD license. From 2caa1a2b533fe9bfcfaab7945d818fe289dc4b52 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 27 Dec 2024 12:57:33 +0100 Subject: [PATCH 2/4] Add dune usage examples --- README.adoc | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/README.adoc b/README.adoc index bff44817..30ffbba2 100644 --- a/README.adoc +++ b/README.adoc @@ -438,3 +438,59 @@ Starting with 0.9, the library is split into several components: Normally, for contributors, `opam pin https://github.com/c-cube/qcheck` will pin all these packages. + + +=== Usage from dune + +We can use the buggy test from above using the `qcheck` opam package: + +[source,OCaml] +---- +(* test.ml *) +let test = + QCheck.Test.make ~count:1000 ~name:"my_buggy_test" + QCheck.(list small_nat) + (fun l -> List.rev l = l) + +let _ = QCheck_runner.run_tests_main [test] +---- + +with the following `dune` file: + +[source] +---- +(test + (name test) + (modules test) + (libraries qcheck) +) +---- + +and run it with `dune exec ./test.exe` or `dune runtest`. + + +Using the `qcheck-core` package instead, we have to adapt the last line of the +example to use `QCheck_base_runner`: + +[source,OCaml] +---- +(* test.ml *) +let test = + QCheck.Test.make ~count:1000 ~name:"my_buggy_test" + QCheck.(list small_nat) + (fun l -> List.rev l = l) + +let _ = QCheck_base_runner.run_tests_main [test] +---- + +and adjust the `dune` file accordingly to use `qcheck-core` and its +`qcheck-core.runner` sub-package: + +[source] +---- +(test + (name test) + (modules test) + (libraries qcheck-core qcheck-core.runner) +) +---- From 411b904fe7cdbdf7730cfaa9e73e96c4bd89382f Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 27 Dec 2024 13:06:52 +0100 Subject: [PATCH 3/4] Add implicit_transitive_deps mention --- README.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index 30ffbba2..f21d7438 100644 --- a/README.adoc +++ b/README.adoc @@ -469,8 +469,9 @@ with the following `dune` file: and run it with `dune exec ./test.exe` or `dune runtest`. -Using the `qcheck-core` package instead, we have to adapt the last line of the -example to use `QCheck_base_runner`: +To keep things minimal or if you are using `(implicit_transitive_deps false)` +in dune, you may want to use the `qcheck-core` package instead. To do so, +we have to adapt the last line of the example to use `QCheck_base_runner`: [source,OCaml] ---- From 98611cd8b821fa7e51fc17f315abab10ff09de67 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 27 Dec 2024 13:07:32 +0100 Subject: [PATCH 4/4] Add CHANGELOG entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea8f31e2..6eb8eeaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## NEXT RELEASE -- ... +- Document `dune` usage in README ## 0.23