diff --git a/tests/test-encoding-align.out b/tests/test-encoding-align.out deleted file mode 100644 --- a/tests/test-encoding-align.out +++ /dev/null @@ -1,34 +0,0 @@ -% check alignment of option descriptions in help -hg showoptlist - -dummy command to show option descriptions - -options: - - -s --opt1 短名 short width - -m --opt2 MIDDLE_ middle width - -l --opt3 長い長い名前 long width - -use "hg -v help showoptlist" to show global options -% check alignment of user names in annotate - 短名: first line(2) - MIDDLE_: second line(2) -長い長い名前: third line(2) -% check alignment of filenames in diffstat - MIDDLE_ | 1 + - 短名 | 1 + - 長い長い名前 | 1 + - 3 files changed, 3 insertions(+), 0 deletions(-) -marked working directory as branch 短名 -marked working directory as branch MIDDLE_ -marked working directory as branch 長い長い名前 -% check alignment of branches -tip 5:d745ff46155b -長い長い名前 4:9259be597f19 -MIDDLE_ 3:b06c5b6def9e -短名 2:64a70663cee8 -% check alignment of tags -tip 5:d745ff46155b -長い長い名前 4:9259be597f19 -MIDDLE_ 3:b06c5b6def9e -短名 2:64a70663cee8 diff --git a/tests/test-encoding-align b/tests/test-encoding-align.t old mode 100755 new mode 100644 rename from tests/test-encoding-align rename to tests/test-encoding-align.t --- a/tests/test-encoding-align +++ b/tests/test-encoding-align.t @@ -1,127 +1,137 @@ -#!/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 +Test alignment of multibyte characters -cmdtable = { - 'showoptlist': - (showoptlist, - [('s', 'opt1', '', 'short width', '""" + s + """'), - ('m', 'opt2', '', 'middle width', '""" + m + """'), - ('l', 'opt3', '', 'long width', '""" + l + """') - ], - "" - ) -} -""") -f.close() -EOF + $ 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` -S=`cat s` -M=`cat m` -L=`cat l` +alignment of option descriptions in help -######################################## -#### alignment of: -#### - option descriptions in help + $ cat < .hg/hgrc + > [extensions] + > ja_ext = `pwd`/showoptlist.py + > EOF + +check alignment of option descriptions in help -cat < .hg/hgrc -[extensions] -ja_ext = `pwd`/showoptlist.py -EOF -echo '% check alignment of option descriptions in help' -hg help showoptlist + $ hg help showoptlist + hg showoptlist + + dummy command to show option descriptions + + options: + + -s --opt1 短名 short width + -m --opt2 MIDDLE_ middle width + -l --opt3 長い長い名前 long width + + use "hg -v help showoptlist" to show global options -######################################## -#### alignment of: -#### - user names in annotate -#### - file names in diffstat + + $ rm -f s; touch s + $ rm -f m; touch m + $ rm -f l; touch l + +add files -rm -f s; touch s -rm -f m; touch m -rm -f l; touch l - -#### add files + $ cp s $S + $ hg add $S + $ cp m $M + $ hg add $M + $ cp l $L + $ hg add $L -cp s $S -hg add $S -cp m $M -hg add $M -cp l $L -hg add $L +commit(1) + + $ echo 'first line(1)' >> s; cp s $S + $ echo 'first line(2)' >> m; cp m $M + $ echo 'first line(3)' >> l; cp l $L + $ hg commit -m 'first commit' -u $S + +commit(2) -#### commit(1) + $ echo 'second line(1)' >> s; cp s $S + $ echo 'second line(2)' >> m; cp m $M + $ echo 'second line(3)' >> l; cp l $L + $ hg commit -m 'second commit' -u $M -echo 'first line(1)' >> s; cp s $S -echo 'first line(2)' >> m; cp m $M -echo 'first line(3)' >> l; cp l $L -hg commit -m 'first commit' -u $S +commit(3) -#### commit(2) + $ echo 'third line(1)' >> s; cp s $S + $ echo 'third line(2)' >> m; cp m $M + $ echo 'third line(3)' >> l; cp l $L + $ hg commit -m 'third commit' -u $L -echo 'second line(1)' >> s; cp s $S -echo 'second line(2)' >> m; cp m $M -echo 'second line(3)' >> l; cp l $L -hg commit -m 'second commit' -u $M +check alignment of user names in annotate -#### commit(3) + $ hg annotate -u $M + 短名: first line(2) + MIDDLE_: second line(2) + 長い長い名前: third line(2) -echo 'third line(1)' >> s; cp s $S -echo 'third line(2)' >> m; cp m $M -echo 'third line(3)' >> l; cp l $L -hg commit -m 'third commit' -u $L - -#### check +check alignment of filenames in diffstat -echo '% check alignment of user names in annotate' -hg annotate -u $M -echo '% check alignment of filenames in diffstat' -hg diff -c tip --stat + $ hg diff -c tip --stat + MIDDLE_ | 1 + + 短名 | 1 + + 長い長い名前 | 1 + + 3 files changed, 3 insertions(+), 0 deletions(-) -######################################## -#### alignment of: -#### - branch names in list -#### - tag names in list +add branches/tags -#### add branches/tags + $ hg branch $S + marked working directory as branch 短名 + $ hg tag $S + $ hg branch $M + marked working directory as branch MIDDLE_ + $ hg tag $M + $ hg branch $L + marked working directory as branch 長い長い名前 + $ hg tag $L -hg branch $S -hg tag $S -hg branch $M -hg tag $M -hg branch $L -hg tag $L +check alignment of branches -#### check + $ hg tags + tip 5:d745ff46155b + 長い長い名前 4:9259be597f19 + MIDDLE_ 3:b06c5b6def9e + 短名 2:64a70663cee8 -echo '% check alignment of branches' -hg tags -echo '% check alignment of tags' -hg tags +check alignment of tags -######################################## - -exit 0 + $ hg tags + tip 5:d745ff46155b + 長い長い名前 4:9259be597f19 + MIDDLE_ 3:b06c5b6def9e + 短名 2:64a70663cee8