Show More
@@ -497,6 +497,12 b' def vlog(*msg):' | |||
|
497 | 497 | # sans \t, \n and \r |
|
498 | 498 | CDATA_EVIL = re.compile(br"[\000-\010\013\014\016-\037]") |
|
499 | 499 | |
|
500 | # Match feature conditionalized output lines in the form, capturing the feature | |
|
501 | # list in group 2, and the preceeding line output in group 1: | |
|
502 | # | |
|
503 | # output..output (feature !)\n | |
|
504 | optline = re.compile(b'(.+) \((.+?) !\)\n$') | |
|
505 | ||
|
500 | 506 | def cdatasafe(data): |
|
501 | 507 | """Make a string safe to include in a CDATA block. |
|
502 | 508 | |
@@ -1271,8 +1277,19 b' class TTest(Test):' | |||
|
1271 | 1277 | if r: |
|
1272 | 1278 | els.pop(i) |
|
1273 | 1279 | break |
|
1274 |
if el |
|
|
1280 | if el: | |
|
1281 | if el.endswith(b" (?)\n"): | |
|
1275 | 1282 | optional.append(i) |
|
1283 | else: | |
|
1284 | m = optline.match(el) | |
|
1285 | if m: | |
|
1286 | conditions = [c for c in m.group(2).split(' ')] | |
|
1287 | ||
|
1288 | if self._hghave(conditions)[0]: | |
|
1289 | lout = el | |
|
1290 | else: | |
|
1291 | optional.append(i) | |
|
1292 | ||
|
1276 | 1293 | i += 1 |
|
1277 | 1294 | |
|
1278 | 1295 | if r: |
@@ -1298,7 +1315,9 b' class TTest(Test):' | |||
|
1298 | 1315 | # clean up any optional leftovers |
|
1299 | 1316 | while expected.get(pos, None): |
|
1300 | 1317 | el = expected[pos].pop(0) |
|
1301 |
if el |
|
|
1318 | if el: | |
|
1319 | if (not optline.match(el) | |
|
1320 | and not el.endswith(b" (?)\n")): | |
|
1302 | 1321 | break |
|
1303 | 1322 | postout.append(b' ' + el) |
|
1304 | 1323 | |
@@ -1371,6 +1390,12 b' class TTest(Test):' | |||
|
1371 | 1390 | if el.endswith(b" (?)\n"): |
|
1372 | 1391 | retry = "retry" |
|
1373 | 1392 | el = el[:-5] + b"\n" |
|
1393 | else: | |
|
1394 | m = optline.match(el) | |
|
1395 | if m: | |
|
1396 | el = m.group(1) + b"\n" | |
|
1397 | retry = "retry" | |
|
1398 | ||
|
1374 | 1399 | if el.endswith(b" (esc)\n"): |
|
1375 | 1400 | if PYTHON3: |
|
1376 | 1401 | el = el[:-7].decode('unicode_escape') + '\n' |
@@ -39,6 +39,19 b' error paths' | |||
|
39 | 39 | $ rm hg |
|
40 | 40 | #endif |
|
41 | 41 | |
|
42 | Features for testing optional lines | |
|
43 | =================================== | |
|
44 | ||
|
45 | $ cat > hghaveaddon.py <<EOF | |
|
46 | > import hghave | |
|
47 | > @hghave.check("custom", "custom hghave feature") | |
|
48 | > def has_custom(): | |
|
49 | > return True | |
|
50 | > @hghave.check("missing", "missing hghave feature") | |
|
51 | > def has_missing(): | |
|
52 | > return False | |
|
53 | > EOF | |
|
54 | ||
|
42 | 55 | an empty test |
|
43 | 56 | ======================= |
|
44 | 57 | |
@@ -67,6 +80,13 b' a succesful test' | |||
|
67 | 80 | > def (?) |
|
68 | 81 | > 456 (?) |
|
69 | 82 | > xyz |
|
83 | > $ printf 'zyx\nwvu\ntsr\n' | |
|
84 | > abc (?) | |
|
85 | > zyx (custom !) | |
|
86 | > wvu | |
|
87 | > no_print (no-custom !) | |
|
88 | > tsr (no-missing !) | |
|
89 | > missing (missing !) | |
|
70 | 90 | > EOF |
|
71 | 91 | |
|
72 | 92 | $ rt |
@@ -341,6 +361,12 b' Running In Debug Mode' | |||
|
341 | 361 | xyz |
|
342 | 362 | + echo *SALT* 15 0 (glob) |
|
343 | 363 | *SALT* 15 0 (glob) |
|
364 | + printf *zyx\nwvu\ntsr\n* (glob) | |
|
365 | zyx | |
|
366 | wvu | |
|
367 | tsr | |
|
368 | + echo *SALT* 22 0 (glob) | |
|
369 | *SALT* 22 0 (glob) | |
|
344 | 370 | . |
|
345 | 371 | # Ran 2 tests, 0 skipped, 0 warned, 0 failed. |
|
346 | 372 |
General Comments 0
You need to be logged in to leave comments.
Login now