Skip to content

Commit e80ac2d

Browse files
committed
cram: only suggest cram tests in error
Signed-off-by: Ali Caglayan <[email protected]>
1 parent ff33ed9 commit e80ac2d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

bin/runtest_common.ml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ let explain_unsuccessful_search path ~parent_dir =
2727
(* We search for all files and directories in the parent directory and
2828
suggest them as possible candidates. *)
2929
let+ candidates =
30-
let+ file_candidates =
31-
let+ files = Source_tree.files_of parent_dir in
32-
Path.Source.Set.to_list_map files ~f:Path.Source.to_string
30+
let+ cram_candidates =
31+
let+ cram_tests = cram_tests_of_dir parent_dir in
32+
List.filter_map cram_tests ~f:(fun res ->
33+
Result.to_option res
34+
|> Option.map ~f:(fun test ->
35+
Source.Cram_test.path test |> Path.Source.to_string))
3336
and+ dir_candidates =
3437
let* parent_source_dir = Source_tree.find_dir parent_dir in
3538
match parent_source_dir with
@@ -42,7 +45,7 @@ let explain_unsuccessful_search path ~parent_dir =
4245
>>| Source_tree.Dir.path
4346
>>| Path.Source.to_string)
4447
in
45-
List.concat [ file_candidates; dir_candidates ]
48+
List.concat [ cram_candidates; dir_candidates ]
4649
in
4750
User_message.did_you_mean (Path.Source.to_string path) ~candidates
4851
in

test/blackbox-tests/test-cases/runtest-cmd-hints.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Test the "did you mean" hints for dune runtest command.
1313

1414
$ dune test dip.t
1515
Error: "dip.t" does not match any known test.
16-
Hint: did you mean dir_t or dir.t?
16+
Hint: did you mean dir.t or dir.t?
1717
[1]
1818

1919
$ dune test other_dip

0 commit comments

Comments
 (0)