##// END OF EJS Templates
tests: unify test-check-code
Brodie Rao -
r12632:6c98107f default
parent child Browse files
Show More
@@ -1,39 +1,54
1 #!/bin/sh
2 #cd `dirname $0`
3 cat > correct.py <<EOF
4 def toto(arg1, arg2):
5 del arg2
6 return (5 + 6, 9)
7 EOF
8
9 cat > wrong.py <<EOF
10 def toto( arg1, arg2):
11 del(arg2)
12 return ( 5+6, 9)
13 EOF
14
15 cat > quote.py <<EOF
16 # let's use quote in comments
17 (''' ( 4x5 )
18 but """\\''' and finally''',
19 """let's fool checkpatch""", '1+2',
20 '"""', 42+1, """and
21 ( 4-1 ) """, "( 1+1 )\" and ")
22 a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
23 EOF
24
25 cat > non-py24.py <<EOF
26 # Using builtins that does not exist in Python 2.4
27 if any():
28 x = all()
29 y = format(x)
30
31 # Do not complain about our own definition
32 def any(x):
33 pass
34 EOF
35
36 check_code=`dirname $0`/../contrib/check-code.py
37 ${check_code} ./wrong.py ./correct.py ./quote.py ./non-py24.py
38
39 exit 0
1 $ cat > correct.py <<EOF
2 > def toto(arg1, arg2):
3 > del arg2
4 > return (5 + 6, 9)
5 > EOF
6 $ cat > wrong.py <<EOF
7 > def toto( arg1, arg2):
8 > del(arg2)
9 > return ( 5+6, 9)
10 > EOF
11 $ cat > quote.py <<EOF
12 > # let's use quote in comments
13 > (''' ( 4x5 )
14 > but """\\''' and finally''',
15 > """let's fool checkpatch""", '1+2',
16 > '"""', 42+1, """and
17 > ( 4-1 ) """, "( 1+1 )\" and ")
18 > a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
19 > EOF
20 $ cat > non-py24.py <<EOF
21 > # Using builtins that does not exist in Python 2.4
22 > if any():
23 > x = all()
24 > y = format(x)
25 >
26 > # Do not complain about our own definition
27 > def any(x):
28 > pass
29 > EOF
30 $ check_code="$TESTDIR"/../contrib/check-code.py
31 $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py
32 ./wrong.py:1:
33 > def toto( arg1, arg2):
34 gratuitous whitespace in () or []
35 ./wrong.py:2:
36 > del(arg2)
37 del isn't a function
38 ./wrong.py:3:
39 > return ( 5+6, 9)
40 missing whitespace in expression
41 gratuitous whitespace in () or []
42 ./quote.py:5:
43 > '"""', 42+1, """and
44 missing whitespace in expression
45 ./non-py24.py:2:
46 > if any():
47 any/all/format not available in Python 2.4
48 ./non-py24.py:3:
49 > x = all()
50 any/all/format not available in Python 2.4
51 ./non-py24.py:4:
52 > y = format(x)
53 any/all/format not available in Python 2.4
54 [1]
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now