##// END OF EJS Templates
run-tests: alternative way of handling \r on Windows...
Mads Kiilerich -
r17777:af7c6bc4 default
parent child Browse files
Show More
@@ -494,8 +494,10 b' def stringescape(s):'
494 494
495 495 def rematch(el, l):
496 496 try:
497 # ensure that the regex matches to the end of the string
498 return re.match(el + r'\Z', l)
497 # use \Z to ensure that the regex matches to the end of the string
498 if os.name == 'nt':
499 return re.match(el + r'\r?\n\Z', l)
500 return re.match(el + r'\n\Z', l)
499 501 except re.error:
500 502 # el is an invalid regex
501 503 return False
@@ -525,12 +527,12 b' def linematch(el, l):'
525 527 if el == l: # perfect match (fast)
526 528 return True
527 529 if (el and
528 (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l) or
529 el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', l) or
530 (el.endswith(" (re)\n") and rematch(el[:-6], l) or
531 el.endswith(" (glob)\n") and globmatch(el[:-8], l) or
530 532 el.endswith(" (esc)\n") and
531 533 (el[:-7].decode('string-escape') + '\n' == l or
532 el[:-7].decode('string-escape').replace('\r', '') +
533 '\n' == l and os.name == 'nt'))):
534 os.name == 'nt' and
535 el[:-7].decode('string-escape') + '\n' == l))):
534 536 return True
535 537 return False
536 538
@@ -885,7 +887,6 b' def runone(options, test):'
885 887 (r':%s\b' % (options.port + 2), ':$HGPORT2'),
886 888 ]
887 889 if os.name == 'nt':
888 replacements.append((r'\r\n', '\n'))
889 890 replacements.append(
890 891 (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or
891 892 c in '/\\' and r'[/\\]' or
@@ -52,6 +52,16 b' Literal match ending in " (re)":'
52 52 $ echo 'foo (re)'
53 53 foo (re)
54 54
55 Windows: \r\n is handled like \n and can be escaped:
56
57 #if windows
58 $ printf 'crlf\r\ncr\r\tcrlf\r\ncrcrlf\r\r\n'
59 crlf
60 cr\r (no-eol) (esc)
61 \tcrlf (esc)
62 crcrlf\r (esc)
63 #endif
64
55 65 testing hghave
56 66
57 67 $ "$TESTDIR/hghave" true
General Comments 0
You need to be logged in to leave comments. Login now