##// END OF EJS Templates
tests: use NO_CHECK_EOF as heredoc limit mark to omit checking code fragments...
FUJIWARA Katsunori -
r40130:ff47ba7a default
parent child Browse files
Show More
@@ -1,14 +1,14 b''
1 $ cat > correct.py <<EOF
1 $ cat > correct.py <<NO_CHECK_EOF
2 2 > def toto(arg1, arg2):
3 3 > del arg2
4 4 > return (5 + 6, 9)
5 > EOF
6 $ cat > wrong.py <<EOF
5 > NO_CHECK_EOF
6 $ cat > wrong.py <<NO_CHECK_EOF
7 7 > def toto( arg1, arg2):
8 8 > del(arg2)
9 9 > return ( 5+6, 9)
10 > EOF
11 $ cat > quote.py <<EOF
10 > NO_CHECK_EOF
11 $ cat > quote.py <<NO_CHECK_EOF
12 12 > # let's use quote in comments
13 13 > (''' ( 4x5 )
14 14 > but """\\''' and finally''',
@@ -16,8 +16,8 b''
16 16 > '"""', 42+1, """and
17 17 > ( 4-1 ) """, "( 1+1 )\" and ")
18 18 > a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
19 > EOF
20 $ cat > classstyle.py <<EOF
19 > NO_CHECK_EOF
20 $ cat > classstyle.py <<NO_CHECK_EOF
21 21 > class newstyle_class(object):
22 22 > pass
23 23 >
@@ -29,7 +29,7 b''
29 29 >
30 30 > no_class = 1:
31 31 > pass
32 > EOF
32 > NO_CHECK_EOF
33 33 $ check_code="$TESTDIR"/../contrib/check-code.py
34 34 $ "$check_code" ./wrong.py ./correct.py ./quote.py ./classstyle.py
35 35 ./wrong.py:1:
@@ -52,11 +52,11 b''
52 52 > class empty():
53 53 class foo() creates old style object, use class foo(object)
54 54 [1]
55 $ cat > python3-compat.py << EOF
55 $ cat > python3-compat.py << NO_CHECK_EOF
56 56 > foo <> bar
57 57 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
58 58 > dict(key=value)
59 > EOF
59 > NO_CHECK_EOF
60 60 $ "$check_code" python3-compat.py
61 61 python3-compat.py:1:
62 62 > foo <> bar
@@ -69,13 +69,13 b''
69 69 dict() is different in Py2 and 3 and is slower than {}
70 70 [1]
71 71
72 $ cat > foo.c <<EOF
72 $ cat > foo.c <<NO_CHECK_EOF
73 73 > void narf() {
74 74 > strcpy(foo, bar);
75 75 > // strcpy_s is okay, but this comment is not
76 76 > strcpy_s(foo, bar);
77 77 > }
78 > EOF
78 > NO_CHECK_EOF
79 79 $ "$check_code" ./foo.c
80 80 ./foo.c:2:
81 81 > strcpy(foo, bar);
@@ -85,7 +85,7 b''
85 85 don't use //-style comments
86 86 [1]
87 87
88 $ cat > is-op.py <<EOF
88 $ cat > is-op.py <<NO_CHECK_EOF
89 89 > # is-operator comparing number or string literal
90 90 > x = None
91 91 > y = x is 'foo'
@@ -96,7 +96,7 b''
96 96 > y = x is not "foo"
97 97 > y = x is not 5346
98 98 > y = x is not -6
99 > EOF
99 > NO_CHECK_EOF
100 100
101 101 $ "$check_code" ./is-op.py
102 102 ./is-op.py:3:
@@ -125,21 +125,21 b''
125 125 object comparison with literal
126 126 [1]
127 127
128 $ cat > for-nolineno.py <<EOF
128 $ cat > for-nolineno.py <<NO_CHECK_EOF
129 129 > except:
130 > EOF
130 > NO_CHECK_EOF
131 131 $ "$check_code" for-nolineno.py --nolineno
132 132 for-nolineno.py:0:
133 133 > except:
134 134 naked except clause
135 135 [1]
136 136
137 $ cat > warning.t <<EOF
137 $ cat > warning.t <<NO_CHECK_EOF
138 138 > $ function warnonly {
139 139 > > }
140 140 > $ diff -N aaa
141 141 > $ function onwarn {}
142 > EOF
142 > NO_CHECK_EOF
143 143 $ "$check_code" warning.t
144 144 $ "$check_code" --warn warning.t
145 145 warning.t:1:
@@ -152,20 +152,20 b''
152 152 > $ function onwarn {}
153 153 warning: don't use 'function', use old style
154 154 [1]
155 $ cat > error.t <<EOF
155 $ cat > error.t <<NO_CHECK_EOF
156 156 > $ [ foo == bar ]
157 > EOF
157 > NO_CHECK_EOF
158 158 $ "$check_code" error.t
159 159 error.t:1:
160 160 > $ [ foo == bar ]
161 161 [ foo == bar ] is a bashism, use [ foo = bar ] instead
162 162 [1]
163 163 $ rm error.t
164 $ cat > raise-format.py <<EOF
164 $ cat > raise-format.py <<NO_CHECK_EOF
165 165 > raise SomeException, message
166 166 > # this next line is okay
167 167 > raise SomeException(arg1, arg2)
168 > EOF
168 > NO_CHECK_EOF
169 169 $ "$check_code" not-existing.py raise-format.py
170 170 Skipping*not-existing.py* (glob)
171 171 raise-format.py:1:
@@ -173,10 +173,10 b''
173 173 don't use old-style two-argument raise, use Exception(message)
174 174 [1]
175 175
176 $ cat <<EOF > tab.t
176 $ cat <<NO_CHECK_EOF > tab.t
177 177 > indent
178 178 > > heredoc
179 > EOF
179 > NO_CHECK_EOF
180 180 $ "$check_code" tab.t
181 181 tab.t:1:
182 182 > indent
@@ -184,7 +184,7 b''
184 184 [1]
185 185 $ rm tab.t
186 186
187 $ cat > rst.py <<EOF
187 $ cat > rst.py <<NO_CHECK_EOF
188 188 > """problematic rst text
189 189 >
190 190 > .. note::
@@ -213,7 +213,7 b''
213 213 > .. note::
214 214 > plus bad
215 215 > """
216 > EOF
216 > NO_CHECK_EOF
217 217 $ $check_code -w rst.py
218 218 rst.py:3:
219 219 > .. note::
@@ -223,7 +223,7 b''
223 223 warning: add two newlines after '.. note::'
224 224 [1]
225 225
226 $ cat > ./map-inside-gettext.py <<EOF
226 $ cat > ./map-inside-gettext.py <<NO_CHECK_EOF
227 227 > print(_("map inside gettext %s" % v))
228 228 >
229 229 > print(_("concatenating " " by " " space %s" % v))
@@ -234,7 +234,7 b''
234 234 >
235 235 > print(_(
236 236 > "leading spaces inside of '(' %s" % v))
237 > EOF
237 > NO_CHECK_EOF
238 238 $ "$check_code" ./map-inside-gettext.py
239 239 ./map-inside-gettext.py:1:
240 240 > print(_("map inside gettext %s" % v))
@@ -256,12 +256,12 b''
256 256 web templates
257 257
258 258 $ mkdir -p mercurial/templates
259 $ cat > mercurial/templates/example.tmpl <<EOF
259 $ cat > mercurial/templates/example.tmpl <<NO_CHECK_EOF
260 260 > {desc}
261 261 > {desc|escape}
262 262 > {desc|firstline}
263 263 > {desc|websub}
264 > EOF
264 > NO_CHECK_EOF
265 265
266 266 $ "$check_code" --warnings mercurial/templates/example.tmpl
267 267 mercurial/templates/example.tmpl:2:
@@ -271,7 +271,7 b' web templates'
271 271
272 272 'string join across lines with no space' detection
273 273
274 $ cat > stringjoin.py <<EOF
274 $ cat > stringjoin.py <<NO_CHECK_EOF
275 275 > foo = (' foo'
276 276 > 'bar foo.'
277 277 > 'bar foo:'
@@ -281,11 +281,11 b' web templates'
281 281 > 'bar foo+'
282 282 > 'bar foo-'
283 283 > 'bar')
284 > EOF
284 > NO_CHECK_EOF
285 285
286 286 'missing _() in ui message' detection
287 287
288 $ cat > uigettext.py <<EOF
288 $ cat > uigettext.py <<NO_CHECK_EOF
289 289 > ui.status("% 10s %05d % -3.2f %*s %%"
290 290 > # this use '\\\\' instead of '\\', because the latter in
291 291 > # heredoc on shell becomes just '\'
@@ -294,11 +294,11 b' web templates'
294 294 > """
295 295 > '''.:*+-=
296 296 > ''' "%-6d \n 123456 .:*+-= foobar")
297 > EOF
297 > NO_CHECK_EOF
298 298
299 299 superfluous pass
300 300
301 $ cat > superfluous_pass.py <<EOF
301 $ cat > superfluous_pass.py <<NO_CHECK_EOF
302 302 > # correct examples
303 303 > if foo:
304 304 > pass
@@ -326,7 +326,7 b' superfluous pass'
326 326 > docstring also
327 327 > means no pass"""
328 328 > pass
329 > EOF
329 > NO_CHECK_EOF
330 330
331 331 (Checking multiple invalid files at once examines whether caching
332 332 translation table for repquote() works as expected or not. All files
General Comments 0
You need to be logged in to leave comments. Login now