##// END OF EJS Templates
tests: add (?) flag for optional lines...
Matt Mackall -
r25388:6025cac3 default
parent child Browse files
Show More
@@ -1043,7 +1043,7 b' class TTest(Test):'
1043 if salt in l:
1043 if salt in l:
1044 lout, lcmd = l.split(salt, 1)
1044 lout, lcmd = l.split(salt, 1)
1045
1045
1046 if lout:
1046 while lout:
1047 if not lout.endswith(b'\n'):
1047 if not lout.endswith(b'\n'):
1048 lout += b' (no-eol)\n'
1048 lout += b' (no-eol)\n'
1049
1049
@@ -1060,6 +1060,9 b' class TTest(Test):'
1060 elif r == '-glob':
1060 elif r == '-glob':
1061 lout = ''.join(el.rsplit(' (glob)', 1))
1061 lout = ''.join(el.rsplit(' (glob)', 1))
1062 r = '' # Warn only this line.
1062 r = '' # Warn only this line.
1063 elif r == "retry":
1064 postout.append(b' ' + el)
1065 continue
1063 else:
1066 else:
1064 log('\ninfo, unknown linematch result: %r\n' % r)
1067 log('\ninfo, unknown linematch result: %r\n' % r)
1065 r = False
1068 r = False
@@ -1074,6 +1077,15 b' class TTest(Test):'
1074 warnonly = 3 # for sure not
1077 warnonly = 3 # for sure not
1075 elif warnonly == 1: # Is "not yet" and line is warn only.
1078 elif warnonly == 1: # Is "not yet" and line is warn only.
1076 warnonly = 2 # Yes do warn.
1079 warnonly = 2 # Yes do warn.
1080 break
1081
1082 # clean up any optional leftovers
1083 while expected.get(pos, None):
1084 el = expected[pos].pop(0)
1085 if not el.endswith(" (?)\n"):
1086 expected[pos].insert(0, el)
1087 break
1088 postout.append(b' ' + el)
1077
1089
1078 if lcmd:
1090 if lcmd:
1079 # Add on last return code.
1091 # Add on last return code.
@@ -1136,9 +1148,13 b' class TTest(Test):'
1136
1148
1137 @staticmethod
1149 @staticmethod
1138 def linematch(el, l):
1150 def linematch(el, l):
1151 retry = False
1139 if el == l: # perfect match (fast)
1152 if el == l: # perfect match (fast)
1140 return True
1153 return True
1141 if el:
1154 if el:
1155 if el.endswith(" (?)\n"):
1156 retry = "retry"
1157 el = el[:-5] + "\n"
1142 if el.endswith(b" (esc)\n"):
1158 if el.endswith(b" (esc)\n"):
1143 if PYTHON3:
1159 if PYTHON3:
1144 el = el[:-7].decode('unicode_escape') + '\n'
1160 el = el[:-7].decode('unicode_escape') + '\n'
@@ -1148,7 +1164,7 b' class TTest(Test):'
1148 if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
1164 if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l:
1149 return True
1165 return True
1150 if el.endswith(b" (re)\n"):
1166 if el.endswith(b" (re)\n"):
1151 return TTest.rematch(el[:-6], l)
1167 return TTest.rematch(el[:-6], l) or retry
1152 if el.endswith(b" (glob)\n"):
1168 if el.endswith(b" (glob)\n"):
1153 # ignore '(glob)' added to l by 'replacements'
1169 # ignore '(glob)' added to l by 'replacements'
1154 if l.endswith(b" (glob)\n"):
1170 if l.endswith(b" (glob)\n"):
@@ -1156,7 +1172,7 b' class TTest(Test):'
1156 return TTest.globmatch(el[:-8], l)
1172 return TTest.globmatch(el[:-8], l)
1157 if os.altsep and l.replace(b'\\', b'/') == el:
1173 if os.altsep and l.replace(b'\\', b'/') == el:
1158 return b'+glob'
1174 return b'+glob'
1159 return False
1175 return retry
1160
1176
1161 @staticmethod
1177 @staticmethod
1162 def parsehghaveoutput(lines):
1178 def parsehghaveoutput(lines):
@@ -21,7 +21,9 b' a succesful test'
21 > $ echo babar
21 > $ echo babar
22 > babar
22 > babar
23 > $ echo xyzzy
23 > $ echo xyzzy
24 > never happens (?)
24 > xyzzy
25 > xyzzy
26 > nor this (?)
25 > EOF
27 > EOF
26
28
27 $ $TESTDIR/run-tests.py --with-hg=`which hg`
29 $ $TESTDIR/run-tests.py --with-hg=`which hg`
@@ -237,8 +239,8 b' Running In Debug Mode'
237 *SALT* 2 0 (glob)
239 *SALT* 2 0 (glob)
238 + echo xyzzy
240 + echo xyzzy
239 xyzzy
241 xyzzy
240 + echo *SALT* 4 0 (glob)
242 + echo *SALT* 6 0 (glob)
241 *SALT* 4 0 (glob)
243 *SALT* 6 0 (glob)
242 .
244 .
243 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
245 # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
244
246
General Comments 0
You need to be logged in to leave comments. Login now