test-encoding-align
127 lines
| 2.5 KiB
| text/plain
|
TextLexer
/ tests / test-encoding-align
FUJIWARA Katsunori
|
r11611 | #!/bin/sh | ||
######################################## | ||||
HGENCODING=utf-8 | ||||
export HGENCODING | ||||
hg init t | ||||
cd t | ||||
python << EOF | ||||
# (byte, width) = (6, 4) | ||||
s = "\xe7\x9f\xad\xe5\x90\x8d" | ||||
# (byte, width) = (7, 7): odd width is good for alignment test | ||||
m = "MIDDLE_" | ||||
# (byte, width) = (18, 12) | ||||
l = "\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d" | ||||
f = file('s', 'w'); f.write(s); f.close() | ||||
f = file('m', 'w'); f.write(m); f.close() | ||||
f = file('l', 'w'); f.write(l); f.close() | ||||
# instant extension to show list of options | ||||
f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 | ||||
def showoptlist(ui, repo, *pats, **opts): | ||||
'''dummy command to show option descriptions''' | ||||
return 0 | ||||
cmdtable = { | ||||
'showoptlist': | ||||
(showoptlist, | ||||
[('s', 'opt1', '', 'short width', '""" + s + """'), | ||||
('m', 'opt2', '', 'middle width', '""" + m + """'), | ||||
('l', 'opt3', '', 'long width', '""" + l + """') | ||||
], | ||||
"" | ||||
) | ||||
} | ||||
""") | ||||
f.close() | ||||
EOF | ||||
S=`cat s` | ||||
M=`cat m` | ||||
L=`cat l` | ||||
######################################## | ||||
#### alignment of: | ||||
#### - option descriptions in help | ||||
cat <<EOF > .hg/hgrc | ||||
[extensions] | ||||
ja_ext = `pwd`/showoptlist.py | ||||
EOF | ||||
echo '% check alignment of option descriptions in help' | ||||
hg help showoptlist | ||||
######################################## | ||||
#### alignment of: | ||||
#### - user names in annotate | ||||
#### - file names in diffstat | ||||
FUJIWARA Katsunori
|
r11674 | rm -f s; touch s | ||
rm -f m; touch m | ||||
rm -f l; touch l | ||||
FUJIWARA Katsunori
|
r11611 | #### add files | ||
FUJIWARA Katsunori
|
r11674 | cp s $S | ||
FUJIWARA Katsunori
|
r11611 | hg add $S | ||
FUJIWARA Katsunori
|
r11674 | cp m $M | ||
FUJIWARA Katsunori
|
r11611 | hg add $M | ||
FUJIWARA Katsunori
|
r11674 | cp l $L | ||
FUJIWARA Katsunori
|
r11611 | hg add $L | ||
#### commit(1) | ||||
FUJIWARA Katsunori
|
r11674 | echo 'first line(1)' >> s; cp s $S | ||
echo 'first line(2)' >> m; cp m $M | ||||
echo 'first line(3)' >> l; cp l $L | ||||
Martin Geisler
|
r12156 | hg commit -m 'first commit' -u $S | ||
FUJIWARA Katsunori
|
r11611 | |||
#### commit(2) | ||||
FUJIWARA Katsunori
|
r11674 | echo 'second line(1)' >> s; cp s $S | ||
echo 'second line(2)' >> m; cp m $M | ||||
echo 'second line(3)' >> l; cp l $L | ||||
Martin Geisler
|
r12156 | hg commit -m 'second commit' -u $M | ||
FUJIWARA Katsunori
|
r11611 | |||
#### commit(3) | ||||
FUJIWARA Katsunori
|
r11674 | echo 'third line(1)' >> s; cp s $S | ||
echo 'third line(2)' >> m; cp m $M | ||||
echo 'third line(3)' >> l; cp l $L | ||||
Martin Geisler
|
r12156 | hg commit -m 'third commit' -u $L | ||
FUJIWARA Katsunori
|
r11611 | |||
#### check | ||||
echo '% check alignment of user names in annotate' | ||||
hg annotate -u $M | ||||
echo '% check alignment of filenames in diffstat' | ||||
hg diff -c tip --stat | ||||
######################################## | ||||
#### alignment of: | ||||
#### - branch names in list | ||||
#### - tag names in list | ||||
#### add branches/tags | ||||
hg branch $S | ||||
Martin Geisler
|
r12156 | hg tag $S | ||
FUJIWARA Katsunori
|
r11611 | hg branch $M | ||
Martin Geisler
|
r12156 | hg tag $M | ||
FUJIWARA Katsunori
|
r11611 | hg branch $L | ||
Martin Geisler
|
r12156 | hg tag $L | ||
FUJIWARA Katsunori
|
r11611 | |||
#### check | ||||
echo '% check alignment of branches' | ||||
hg tags | ||||
echo '% check alignment of tags' | ||||
hg tags | ||||
######################################## | ||||
exit 0 | ||||