Mercurial > hg
annotate tests/test-check-code @ 10722:c4fb2103e734
check-code: improve quote detection regexp, add tests
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 17 Mar 2010 14:15:33 +0100 |
parents | 83dce0f817f4 |
children | 62b8f15683f2 |
rev | line source |
---|---|
10715
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
1 #!/bin/sh |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
2 #cd `dirname $0` |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
3 cat > correct.py <<EOF |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
4 def toto(arg1, arg2): |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
5 del arg2 |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
6 return (5 + 6, 9) |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
7 EOF |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
8 |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
9 cat > wrong.py <<EOF |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
10 def toto( arg1, arg2): |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
11 del(arg2) |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
12 return ( 5+6, 9) |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
13 EOF |
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
14 |
10722
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
15 cat > quote.py <<EOF |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
16 (''' ( 4x5 ) |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
17 but """\''' and finally''', |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
18 """let's fool checkpatch""", '1+2', |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
19 '"""', 42+1, """and |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
20 ( 4-1 ) """, "( 1+1 )\" and ") |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
21 EOF |
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
22 |
10715
83dce0f817f4
add a small test for contrib/check-code.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
23 check_code=`dirname $0`/../contrib/check-code.py |
10722
c4fb2103e734
check-code: improve quote detection regexp, add tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10715
diff
changeset
|
24 ${check_code} ./wrong.py ./correct.py ./quote.py |