##// END OF EJS Templates
tests: use (esc) markup for string-escape...
Mads Kiilerich -
r12941:b911cb80 stable
parent child Browse files
Show More
@@ -454,6 +454,15 b' def shtest(test, options, replacements):'
454 vlog("# Running", cmd)
454 vlog("# Running", cmd)
455 return run(cmd, options, replacements)
455 return run(cmd, options, replacements)
456
456
457 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
458 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub
459 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256))
460 escapemap.update({'\\': '\\\\', '\r': r'\r'})
461 def escapef(m):
462 return escapemap[m.group(0)]
463 def stringescape(s):
464 return escapesub(escapef, s)
465
457 def tsttest(test, options, replacements):
466 def tsttest(test, options, replacements):
458 t = open(test)
467 t = open(test)
459 out = []
468 out = []
@@ -545,13 +554,14 b' def tsttest(test, options, replacements)'
545
554
546 if el == lout: # perfect match (fast)
555 if el == lout: # perfect match (fast)
547 postout.append(" " + lout)
556 postout.append(" " + lout)
548 elif el and el.decode('string-escape') == l:
549 postout.append(" " + el) # \-escape match
550 elif (el and
557 elif (el and
551 (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', lout) or
558 (el.endswith(" (re)\n") and rematch(el[:-6] + '\n', lout) or
552 el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout))):
559 el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout)) or
553 postout.append(" " + el) # fallback regex/glob match
560 el.endswith(" (esc)\n") and el.decode('string-escape') == l):
561 postout.append(" " + el) # fallback regex/glob/esc match
554 else:
562 else:
563 if needescape(lout):
564 lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
555 postout.append(" " + lout) # let diff deal with it
565 postout.append(" " + lout) # let diff deal with it
556
566
557 if lcmd:
567 if lcmd:
@@ -52,9 +52,9 b' check alignment of option descriptions i'
52
52
53 options:
53 options:
54
54
55 -s --opt1 \xe7\x9f\xad\xe5\x90\x8d short width
55 -s --opt1 \xe7\x9f\xad\xe5\x90\x8d short width (esc)
56 -m --opt2 MIDDLE_ middle width
56 -m --opt2 MIDDLE_ middle width
57 -l --opt3 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d long width
57 -l --opt3 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d long width (esc)
58
58
59 use "hg -v help showoptlist" to show global options
59 use "hg -v help showoptlist" to show global options
60
60
@@ -96,42 +96,42 b' commit(3)'
96 check alignment of user names in annotate
96 check alignment of user names in annotate
97
97
98 $ hg annotate -u $M
98 $ hg annotate -u $M
99 \xe7\x9f\xad\xe5\x90\x8d: first line(2)
99 \xe7\x9f\xad\xe5\x90\x8d: first line(2) (esc)
100 MIDDLE_: second line(2)
100 MIDDLE_: second line(2)
101 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d: third line(2)
101 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d: third line(2) (esc)
102
102
103 check alignment of filenames in diffstat
103 check alignment of filenames in diffstat
104
104
105 $ hg diff -c tip --stat
105 $ hg diff -c tip --stat
106 MIDDLE_ | 1 +
106 MIDDLE_ | 1 +
107 \xe7\x9f\xad\xe5\x90\x8d | 1 +
107 \xe7\x9f\xad\xe5\x90\x8d | 1 + (esc)
108 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d | 1 +
108 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d | 1 + (esc)
109 3 files changed, 3 insertions(+), 0 deletions(-)
109 3 files changed, 3 insertions(+), 0 deletions(-)
110
110
111 add branches/tags
111 add branches/tags
112
112
113 $ hg branch $S
113 $ hg branch $S
114 marked working directory as branch \xe7\x9f\xad\xe5\x90\x8d
114 marked working directory as branch \xe7\x9f\xad\xe5\x90\x8d (esc)
115 $ hg tag $S
115 $ hg tag $S
116 $ hg branch $M
116 $ hg branch $M
117 marked working directory as branch MIDDLE_
117 marked working directory as branch MIDDLE_
118 $ hg tag $M
118 $ hg tag $M
119 $ hg branch $L
119 $ hg branch $L
120 marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d
120 marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d (esc)
121 $ hg tag $L
121 $ hg tag $L
122
122
123 check alignment of branches
123 check alignment of branches
124
124
125 $ hg tags
125 $ hg tags
126 tip 5:d745ff46155b
126 tip 5:d745ff46155b
127 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 4:9259be597f19
127 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 4:9259be597f19 (esc)
128 MIDDLE_ 3:b06c5b6def9e
128 MIDDLE_ 3:b06c5b6def9e
129 \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8
129 \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc)
130
130
131 check alignment of tags
131 check alignment of tags
132
132
133 $ hg tags
133 $ hg tags
134 tip 5:d745ff46155b
134 tip 5:d745ff46155b
135 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 4:9259be597f19
135 \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 4:9259be597f19 (esc)
136 MIDDLE_ 3:b06c5b6def9e
136 MIDDLE_ 3:b06c5b6def9e
137 \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8
137 \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc)
@@ -148,7 +148,7 b''
148 $ hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip \
148 $ hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip \
149 > --config extensions.progress= --config progress.assume-tty=1 \
149 > --config extensions.progress= --config progress.assume-tty=1 \
150 > --config progress.delay=0 --config progress.refresh=0
150 > --config progress.delay=0 --config progress.refresh=0
151 \rwriting [ ] 0/3\rwriting [ ] 0/3\r \r\r \r\rwriting [====================> ] 1/3\rwriting [====================> ] 1/3\r \r\r \r\rwriting [==========================================> ] 2/3\rwriting [==========================================> ] 2/3\r \rThis patch series consists of 2 patches.
151 \rwriting [ ] 0/3\rwriting [ ] 0/3\r \r\r \r\rwriting [====================> ] 1/3\rwriting [====================> ] 1/3\r \r\r \r\rwriting [==========================================> ] 2/3\rwriting [==========================================> ] 2/3\r \rThis patch series consists of 2 patches. (esc)
152
152
153
153
154 Write the introductory message for the patch series.
154 Write the introductory message for the patch series.
General Comments 0
You need to be logged in to leave comments. Login now