diff options
Diffstat (limited to 'bash_test.sh')
-rwxr-xr-x | bash_test.sh | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/bash_test.sh b/bash_test.sh index 675026a..9bd28f4 100755 --- a/bash_test.sh +++ b/bash_test.sh @@ -18,14 +18,11 @@ test_includes() { if [ ! -e "$f" ]; then continue fi - # Check that the public files (in lib/include/ directory) don't use the full - # path to the public header since users of the library will include the - # library as: #include "jxl/foobar.h". - if [[ "${f#lib/include/}" != "${f}" ]]; then - if grep -i -H -n -E '#include\s*[<"]lib/include/jxl' "$f" >&2; then - echo "Don't add \"include/\" to the include path of public headers." >&2 - ret=1 - fi + # Check that the full paths to the public headers are not used, since users + # of the library will include the library as: #include "jxl/foobar.h". + if grep -i -H -n -E '#include\s*[<"]lib/include/jxl' "$f" >&2; then + echo "Don't add \"include/\" to the include path of public headers." >&2 + ret=1 fi if [[ "${f#third_party/}" == "$f" ]]; then @@ -103,9 +100,15 @@ test_printf_size_t() { ret=1 fi + if grep -n -E '[^_]gtest\.h' \ + $(git ls-files | grep -E '(\.c|\.cc|\.cpp|\.h)$' | grep -v -F /testing.h); then + echo "Don't include gtest directly, instead include 'testing.h'. " >&2 + ret=1 + fi + if grep -n -E 'gmock\.h' \ - $(git ls-files | grep -E '(\.c|\.cc|\.cpp|\.h)$' | grep -v -F /test_utils.h); then - echo "Don't include gmock directly, instead include 'test_utils.h'. " >&2 + $(git ls-files | grep -E '(\.c|\.cc|\.cpp|\.h)$' | grep -v -F /testing.h); then + echo "Don't include gmock directly, instead include 'testing.h'. " >&2 ret=1 fi @@ -122,7 +125,7 @@ test_printf_size_t() { fi done - for f in $(git ls-files | grep -E "\.h$" | grep -v -E '(printf_macros\.h|test_utils\.h)' | + for f in $(git ls-files | grep -E "\.h$" | grep -v -E '(printf_macros\.h|testing\.h)' | xargs grep -n 'PRI[udx]S'); do # Having PRIuS / PRIdS in a header file means that printf_macros.h may # be included before a system header, in particular before gtest headers. |