tests/test-check-code
branchstable
changeset 12795 3cb0559e44d0
parent 12793 469850088fc1
parent 12794 6bf8d48bec8e
child 12796 bc69ba99e34b
equal deleted inserted replaced
12793:469850088fc1 12795:3cb0559e44d0
     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