Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
6c98107f
Commit
6c98107f
authored
14 years ago
by
Brodie Rao
Browse files
Options
Downloads
Patches
Plain Diff
tests: unify test-check-code
parent
7b34fdff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test-check-code.out
+0
-22
0 additions, 22 deletions
tests/test-check-code.out
tests/test-check-code.t
+54
-39
54 additions, 39 deletions
tests/test-check-code.t
with
54 additions
and
61 deletions
tests/test-check-code.out
deleted
100644 → 0
+
0
−
22
View file @
7b34fdff
./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 []
./quote.py:5:
> '"""', 42+1, """and
missing whitespace in expression
./non-py24.py:2:
> if any():
any/all/format not available in Python 2.4
./non-py24.py:3:
> x = all()
any/all/format not available in Python 2.4
./non-py24.py:4:
> y = format(x)
any/all/format not available in Python 2.4
This diff is collapsed.
Click to expand it.
tests/test-check-code
→
tests/test-check-code
.t
100755 → 100644
+
54
−
39
View file @
6c98107f
#!/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
cat
>
quote.py
<<
EOF
# let's use quote in comments
(''' ( 4x5 )
but """
\\
''' and finally''',
"""let's fool checkpatch""", '1+2',
'"""', 42+1, """and
( 4-1 ) """, "( 1+1 )
\"
and ")
a, '
\\\\\\\\
', "
\\\\\\
" x-2", "c-1"
EOF
cat
>
non-py24.py
<<
EOF
# Using builtins that does not exist in Python 2.4
if any():
x = all()
y = format(x)
# Do not complain about our own definition
def any(x):
pass
EOF
check_code
=
`
dirname
$0
`
/../contrib/check-code.py
${
check_code
}
./wrong.py ./correct.py ./quote.py ./non-py24.py
exit
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
$
cat
>
quote
.
py
<<
EOF
>
# let's use quote in comments
>
('''
( 4x5 )
> but """
\\
'''
and
finally
'''
,
> """let
'
s fool checkpatch""", '1+2',
> '"""', 42+1, """and
> ( 4-1 ) """, "( 1+1 )\" and ")
> a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
> EOF
$ cat > non-py24.py <<EOF
> # Using builtins that does not exist in Python 2.4
> if any():
> x = all()
> y = forma
t
(
x
)
>
>
# Do not complain about our own definition
>
def
any
(
x
):
>
pass
>
EOF
$
check_code
=
"
$TESTDIR
"
/../con
trib
/
check
-
code
.
py
$
"
$check_code
"
.
/wrong.py ./co
rrect
.
py
.
/quote.py ./non
-
py24
.
py
./
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 []
./quote.py:5:
>
'"""
', 42+1,
"""
and
missing
whitespace
in
expression
./
non
-
py24
.
py:2:
>
if
any
():
any
/all/
format
not
available
in
Python
2.4
./
non
-
py24
.
py:3:
>
x
=
all
()
any
/all/
format
not
available
in
Python
2.4
./
non
-
py24
.
py:4:
>
y
=
format
(
x
)
any
/all/
format
not
available
in
Python
2.4
[
1
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment