tests/test-check-code.t
changeset 25199 e78447e61624
parent 25198 db77ff0b63da
child 27909 3203dfe341f9
equal deleted inserted replaced
25198:db77ff0b63da 25199:e78447e61624
    15   > """let's fool checkpatch""", '1+2',
    15   > """let's fool checkpatch""", '1+2',
    16   > '"""', 42+1, """and
    16   > '"""', 42+1, """and
    17   > ( 4-1 ) """, "( 1+1 )\" and ")
    17   > ( 4-1 ) """, "( 1+1 )\" and ")
    18   > a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
    18   > a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
    19   > EOF
    19   > EOF
    20   $ cat > non-py24.py <<EOF
       
    21   > # try/except/finally block does not exist in Python 2.4
       
    22   >     try:
       
    23   >         pass
       
    24   >     except StandardError, inst:
       
    25   >         pass
       
    26   >     finally:
       
    27   >         pass
       
    28   > 
       
    29   > # nested try/finally+try/except is allowed
       
    30   >     try:
       
    31   >         try:
       
    32   >             pass
       
    33   >         except StandardError, inst:
       
    34   >             pass
       
    35   >     finally:
       
    36   >         pass
       
    37   > 
       
    38   > EOF
       
    39   $ cat > classstyle.py <<EOF
    20   $ cat > classstyle.py <<EOF
    40   > class newstyle_class(object):
    21   > class newstyle_class(object):
    41   >     pass
    22   >     pass
    42   > 
    23   > 
    43   > class oldstyle_class:
    24   > class oldstyle_class:
    48   > 
    29   > 
    49   > no_class = 1:
    30   > no_class = 1:
    50   >     pass
    31   >     pass
    51   > EOF
    32   > EOF
    52   $ check_code="$TESTDIR"/../contrib/check-code.py
    33   $ check_code="$TESTDIR"/../contrib/check-code.py
    53   $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py
    34   $ "$check_code" ./wrong.py ./correct.py ./quote.py ./classstyle.py
    54   ./wrong.py:1:
    35   ./wrong.py:1:
    55    > def toto( arg1, arg2):
    36    > def toto( arg1, arg2):
    56    gratuitous whitespace in () or []
    37    gratuitous whitespace in () or []
    57   ./wrong.py:2:
    38   ./wrong.py:2:
    58    >     del(arg2)
    39    >     del(arg2)