From 60bf675c10c8ebd1d0258b3a6f2dea08f4dc0b77 Mon Sep 17 00:00:00 2001 From: Maximilien Colange Date: Tue, 28 Mar 2017 13:08:46 +0200 Subject: [PATCH] Improve sanity tests. * tests/sanity/style.test: improve detection of assert in headers, and of template arguments. --- tests/sanity/style.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sanity/style.test b/tests/sanity/style.test index 2cd2b0987..9426c9571 100755 --- a/tests/sanity/style.test +++ b/tests/sanity/style.test @@ -150,7 +150,7 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do case $file in *.test);; *) - $GREP -E '[^<]class[ \t]+[A-Z]' $tmp && + $GREP -E '(>[^>]*|^[^<]*)class[ \t]+[A-Z]' $tmp && diag 'Use lower case class names.' $GREP '[ ]if(' $tmp && @@ -267,7 +267,7 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do e$GREP '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp && diag 'Prefer empty() to check emptiness.' - e$GREP 'assert\((0|!".*")\)' $tmp | $GREP -v 'static_assert' && + e$GREP 'assert\((0|!".*")\)' $tmp && diag 'Prefer SPOT_UNREACHABLE or SPOT_UNIMPLEMENTED.' e$GREP '^[^=*<]*([+][+]|--);' $tmp && @@ -307,7 +307,7 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do *) $GREP '#.*include.*priv/' $tmp && diag 'Do not include private headers in public headers.' - $GREP -v '#' $tmp | $GREP 'assert[ ]*(.*)' | $GREP -v 'static_assert'&& + $GREP '^[^#]*[^#_]assert[ ]*(.*)' $tmp && diag 'Use SPOT_ASSERT() instead of assert() in public headers.' ;;