[go: up one dir, main page]

[--match] now matches on both file and title

Description / Motivation

Branched out from !13 (merged) .

  • --match now applies to both test title and test filename.

How to Test the MR Manually

Register some tests:

let () =
  let files =
    [
      ("foo.ml", "test foo.ml");
      ("foo.ml", "test something else");
      ("bar.ml", "test bar.ml");
      ("baz.ml", "also test foo.ml");
    ]
  in
  List.iter
    (fun (__FILE__, title) ->
      Test.register ~__FILE__ ~title ~tags:["registration"] (fun () -> unit))
    files

Match on both filename and title:

$ dune exec test/unix/main.exe -- --list --match 'foo.ml'
+--------+---------------------+--------------+
|  FILE  |        TITLE        |     TAGS     |
+--------+---------------------+--------------+
| foo.ml | test foo.ml         | registration |
| foo.ml | test something else | registration |
| baz.ml | also test foo.ml    | registration |
+--------+---------------------+--------------+

Match only on file name:

$ dune exec test/unix/main.exe -- --list --match '^foo.ml:'
+--------+---------------------+--------------+
|  FILE  |        TITLE        |     TAGS     |
+--------+---------------------+--------------+
| foo.ml | test foo.ml         | registration |
| foo.ml | test something else | registration |
+--------+---------------------+--------------+

Match only on test title (approximately):

$ dune exec test/unix/main.exe -- --list --match ':.*foo.ml$'
+--------+------------------+--------------+
|  FILE  |      TITLE       |     TAGS     |
+--------+------------------+--------------+
| foo.ml | test foo.ml      | registration |
| baz.ml | also test foo.ml | registration |
+--------+------------------+--------------+

Checklist

  • Update CHANGES.md. No need to document changes to documentation and tests.
  • Make sure all new values, types etc. are documented in .mli files and that the generated documentation looks ok.
  • Add tests in test/, if relevant.

Merge request reports

Loading