Mercurial > public > mercurial-scm > hg-stable
diff tests/test-contrib-check-code.t @ 28594:d3990da51637
check-code: prevent use of strcpy
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 19 Mar 2016 20:18:38 -0400 |
parents | 8833daddfc3f |
children | 4dd530df4742 |
line wrap: on
line diff
--- a/tests/test-contrib-check-code.t Sat Mar 19 20:02:19 2016 -0400 +++ b/tests/test-contrib-check-code.t Sat Mar 19 20:18:38 2016 -0400 @@ -69,6 +69,22 @@ dict() is different in Py2 and 3 and is slower than {} [1] + $ cat > foo.c <<EOF + > void narf() { + > strcpy(foo, bar); + > // strcpy_s is okay, but this comment is not + > strcpy_s(foo, bar); + > } + > EOF + $ "$check_code" ./foo.c + ./foo.c:2: + > strcpy(foo, bar); + don't use strcpy, use strlcpy or memcpy + ./foo.c:3: + > // strcpy_s is okay, but this comment is not + don't use //-style comments + [1] + $ cat > is-op.py <<EOF > # is-operator comparing number or string literal > x = None