From 13a3af5863341875cb453c6d2d9d4c1b8ee29c18 Mon Sep 17 00:00:00 2001 From: Ali Caglayan Date: Thu, 24 Oct 2024 14:44:34 +0100 Subject: [PATCH] test: specify intended features of dune runtest Signed-off-by: Ali Caglayan --- test/blackbox-tests/test-cases/runtest-cmd.t | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/blackbox-tests/test-cases/runtest-cmd.t diff --git a/test/blackbox-tests/test-cases/runtest-cmd.t b/test/blackbox-tests/test-cases/runtest-cmd.t new file mode 100644 index 000000000000..885b99509d8e --- /dev/null +++ b/test/blackbox-tests/test-cases/runtest-cmd.t @@ -0,0 +1,48 @@ +Here we test the features of the `dune runtest` command. + + $ cat > dune-project < (lang dune 3.16) + > EOF + + $ cat > mytest.t < $ echo "Hello, world!" + > "Goodbye, world!" + > EOF + $ mkdir -p tests/myothertest.t + $ cat > tests/myothertest.t/run.t < $ echo "Hello, world!" + > "Goodbye, world!" + > EOF + +Passing no arguments to `dune runtest` should be equivalent to `dune build +@runtest`. + + $ dune test 2>&1 | grep "^File" + File "mytest.t", line 1, characters 0-0: + File "tests/myothertest.t/run.t", line 1, characters 0-0: + +Passing the name of a test should only run that test. +Currently, this is not the case. + + $ dune test mytest + Error: Don't know about directory mytest specified on the command line! + [1] + $ dune test mytest.t + Error: Don't know about directory mytest.t specified on the command line! + [1] + $ dune test tests/myothertest + Error: Don't know about directory tests/myothertest specified on the command + line! + [1] + $ dune test tests/myothertest.t + +Passing a directory should run all the tests in that directory (recursively). + +The current working directory: + $ dune test . 2>&1 | grep "^File" + File "mytest.t", line 1, characters 0-0: + File "tests/myothertest.t/run.t", line 1, characters 0-0: + +The tests/ subdirectory: + $ dune test tests/ 2>&1 | grep "^File" + File "tests/myothertest.t/run.t", line 1, characters 0-0: