Skip to content

Commit db983be

Browse files
tests: Add lint-tests.sh which checks the test suite naming convention
1 parent 5fd864f commit db983be

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

contrib/devtools/lint-tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2018 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
#
7+
# Check the test suite naming convention
8+
9+
NAMING_INCONSISTENCIES=$(git grep -E '^BOOST_FIXTURE_TEST_SUITE\(' -- \
10+
"src/test/**.cpp" "src/wallet/test/**.cpp" | \
11+
grep -vE '/(.*?)\.cpp:BOOST_FIXTURE_TEST_SUITE\(\1, .*\)$')
12+
if [[ ${NAMING_INCONSISTENCIES} != "" ]]; then
13+
echo "The test suite in file src/test/foo_tests.cpp should be named"
14+
echo "\"foo_tests\". Please make sure the following test suites follow"
15+
echo "that convention:"
16+
echo
17+
echo "${NAMING_INCONSISTENCIES}"
18+
exit 1
19+
fi

0 commit comments

Comments
 (0)