summaryrefslogtreecommitdiff
path: root/tests/checkpatch.at
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2019-02-18 18:35:02 +0300
committerBen Pfaff <blp@ovn.org>2019-02-22 12:48:43 -0800
commit9307fc4600ea586ecf898754acb1b37762ce7748 (patch)
treede7457044c32750a4faf137deab575a11a4a985e /tests/checkpatch.at
parent692fc656fe530bec68373aa929367c8204bab3e7 (diff)
downloadopenvswitch-9307fc4600ea586ecf898754acb1b37762ce7748.tar.gz
checkpatch: Escape range operators inside regex.
' -(' matches a single character in the range between ' ' (index 32) and '(' (index 40). This leads to the false positive: WARNING: Line lacks whitespace around operator #445 FILE: ovsdb/monitor.c:573: if (--mcs->n_refs == 0) { Need to escape '-' to have a right behaviour. This patch additionally escapes all other '-' chars in the similar regexes and makes them be one per line to ease the review in case of future changes. Basic unit tests added. CC: Joe Stringer <joe@ovn.org> Fixes: 0d7b16daea50 ("checkpatch: Check for infix operator whitespace.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests/checkpatch.at')
-rwxr-xr-xtests/checkpatch.at18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index 17976dfbb..9a72bc279 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -310,3 +310,21 @@ try_checkpatch \
"
AT_CLEANUP
+
+AT_SETUP([checkpatch - whitespace around operator])
+try_checkpatch \
+ "COMMON_PATCH_HEADER
+ + if (--mcs->n_refs == 0) {
+ "
+
+try_checkpatch \
+ "COMMON_PATCH_HEADER
+ + if (--mcs->n_refs==0) {
+ " \
+ "WARNING: Line lacks whitespace around operator
+ WARNING: Line lacks whitespace around operator
+ #8 FILE: A.c:1:
+ if (--mcs->n_refs==0) {
+"
+
+AT_CLEANUP