* tests/sanity/style.test: Don't use egrep.
This commit is contained in:
parent
93ded57e52
commit
14347cdc52
1 changed files with 7 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2009-2022 Laboratoire de Recherche et Développement de
|
# Copyright (C) 2009-2023 Laboratoire de Recherche et Développement de
|
||||||
# l'Epita (LRDE).
|
# l'Epita (LRDE).
|
||||||
# Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6
|
# Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6
|
||||||
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||||
|
|
@ -267,23 +267,23 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
|
||||||
|
|
||||||
# std::list::size() can be O(n). Better use empty() whenever
|
# std::list::size() can be O(n). Better use empty() whenever
|
||||||
# possible, even for other containers.
|
# possible, even for other containers.
|
||||||
e$GREP '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp &&
|
$GREP -E '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp &&
|
||||||
diag 'Prefer empty() to check emptiness.'
|
diag 'Prefer empty() to check emptiness.'
|
||||||
|
|
||||||
$GREP -E 'std::cerr.*<<.*endl' $tmp &&
|
$GREP -E 'std::cerr.*<<.*endl' $tmp &&
|
||||||
diag 'std::cerr has unitbuf set; use \\n instead of endl'
|
diag 'std::cerr has unitbuf set; use \\n instead of endl'
|
||||||
|
|
||||||
e$GREP 'assert\((0|!".*")\)' $tmp &&
|
$GREP -E 'assert\((0|!".*")\)' $tmp &&
|
||||||
diag 'Prefer SPOT_UNREACHABLE or SPOT_UNIMPLEMENTED.'
|
diag 'Prefer SPOT_UNREACHABLE or SPOT_UNIMPLEMENTED.'
|
||||||
|
|
||||||
e$GREP '^[^=*<]*([+][+]|--);' $tmp &&
|
$GREP -E '^[^=*<]*([+][+]|--);' $tmp &&
|
||||||
diag 'Take good habits: use ++i instead of i++ when you have the choice.'
|
diag 'Take good habits: use ++i instead of i++ when you have the choice.'
|
||||||
|
|
||||||
$GREP '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp &&
|
$GREP '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp &&
|
||||||
diag 'Use "x->y", not "(*x).y"'
|
diag 'Use "x->y", not "(*x).y"'
|
||||||
|
|
||||||
# we allow these functions only in ?...:...
|
# we allow these functions only in ?...:...
|
||||||
e$GREP 'bdd_(false|true)[ ]*\(' $tmp | $GREP -v '[?:]' &&
|
$GREP -E 'bdd_(false|true)[ ]*\(' $tmp | $GREP -v '[?:]' &&
|
||||||
diag 'Use bddfalse and bddtrue instead of bdd_false() and bdd_true()'
|
diag 'Use bddfalse and bddtrue instead of bdd_false() and bdd_true()'
|
||||||
|
|
||||||
res=`perl -ne '$/ = undef;
|
res=`perl -ne '$/ = undef;
|
||||||
|
|
@ -300,7 +300,7 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
|
||||||
|
|
||||||
case $file in
|
case $file in
|
||||||
*.hh | *.hxx)
|
*.hh | *.hxx)
|
||||||
if e$GREP '(<<|>>)' $tmp >/dev/null; then
|
if $GREP -E '(<<|>>)' $tmp >/dev/null; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
$GREP '#.*include.*<iostream>' $tmp &&
|
$GREP '#.*include.*<iostream>' $tmp &&
|
||||||
|
|
@ -338,7 +338,7 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
|
||||||
$GREP '^[ ]*class[ ]' $tmp &&
|
$GREP '^[ ]*class[ ]' $tmp &&
|
||||||
diag 'Private definitions must be in anonymous namespace.'
|
diag 'Private definitions must be in anonymous namespace.'
|
||||||
fi
|
fi
|
||||||
e$GREP ' ' $tmp &&
|
$GREP ' ' $tmp &&
|
||||||
diag 'Use spaces instead of tabs.'
|
diag 'Use spaces instead of tabs.'
|
||||||
case $file in
|
case $file in
|
||||||
*/bin/*) ;;
|
*/bin/*) ;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue