Skip to content

Commit

Permalink
t/unit-tests: handle dashes in test suite filenames
Browse files Browse the repository at this point in the history
The script is designed to extract function signatures that match a
specific pattern derived from the unit test file's name.
`generate-clar-decls.sh` does not pick up dashes in filenames, which
prevents the scripts from being run.

Adapt script to translate dashes (`-`) in test suite filenames to
underscores (`_`) to correctly extract the function signatures and run
the corresponding tests. This will be used by subsequent commits which
follows the same construct.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Seyi007 authored and gitster committed Jan 16, 2025
1 parent 757161e commit ed2916a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions t/unit-tests/generate-clar-decls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ do
suite_name=$(basename "$suite")
suite_name=${suite_name%.c}
suite_name=${suite_name#u-}
suite_name=$(echo "$suite_name" | tr '-' '_')
sed -ne "s/^\(void test_${suite_name}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
exit 1
done >"$OUTPUT"

0 comments on commit ed2916a

Please sign in to comment.