add a small test for contrib/check-code.py
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 16 Mar 2010 19:52:55 +0100
changeset 10715 83dce0f817f4
parent 10714 9c0a1887bd4b
child 10716 5f92bde72eef
add a small test for contrib/check-code.py This changeset adds a test file for contrib/check-code.py. This test runs check-code.py against two small files. The first file should not raise any check-code.py error while the second should. A line contains multiple errors to verify the check-code.py behaviour: In the case of multiple errors at the same line, the context line should only be displayed once.
tests/test-check-code
tests/test-check-code.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-check-code	Tue Mar 16 19:52:55 2010 +0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+#cd `dirname $0`
+cat > correct.py <<EOF
+def toto(arg1, arg2):
+    del arg2
+    return (5 + 6, 9)
+EOF
+
+cat > wrong.py <<EOF
+def toto( arg1, arg2):
+    del(arg2)
+    return ( 5+6, 9)
+EOF
+
+check_code=`dirname $0`/../contrib/check-code.py
+${check_code} ./wrong.py ./correct.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-check-code.out	Tue Mar 16 19:52:55 2010 +0100
@@ -0,0 +1,10 @@
+./wrong.py:1:
+ > def toto( arg1, arg2):
+ gratuitous whitespace in () or []
+./wrong.py:2:
+ >     del(arg2)
+ del isn't a function
+./wrong.py:3:
+ >     return ( 5+6, 9)
+ missing whitespace in expression
+ gratuitous whitespace in () or []