tests/test-encoding-align.t
author Matt Mackall <mpm@selenic.com>
Sun, 26 Sep 2010 13:41:32 -0500
changeset 12418 09c6dd129f82
parent 12156 tests/test-encoding-align@4c94b6d0fb1c
child 12722 22f45e53bb21
permissions -rw-r--r--
tests: unify test-encoding-align
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     1
Test alignment of multibyte characters
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     2
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     3
  $ HGENCODING=utf-8
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     4
  $ export HGENCODING
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     5
  $ hg init t
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     6
  $ cd t
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     7
  $ python << EOF
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     8
  > # (byte, width) = (6, 4)
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     9
  > s = "\xe7\x9f\xad\xe5\x90\x8d"
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    10
  > # (byte, width) = (7, 7): odd width is good for alignment test
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    11
  > m = "MIDDLE_"
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    12
  > # (byte, width) = (18, 12)
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    13
  > l = "\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d"
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    14
  > f = file('s', 'w'); f.write(s); f.close()
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    15
  > f = file('m', 'w'); f.write(m); f.close()
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    16
  > f = file('l', 'w'); f.write(l); f.close()
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    17
  > # instant extension to show list of options
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    18
  > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    19
  > def showoptlist(ui, repo, *pats, **opts):
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    20
  >     '''dummy command to show option descriptions'''
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    21
  >     return 0
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    22
  > cmdtable = {
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    23
  >     'showoptlist':
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    24
  >         (showoptlist,
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    25
  >          [('s', 'opt1', '', 'short width',  '""" + s + """'),
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    26
  >           ('m', 'opt2', '', 'middle width', '""" + m + """'),
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    27
  >           ('l', 'opt3', '', 'long width',   '""" + l + """')
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    28
  >          ],
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    29
  >          ""
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    30
  >         )
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    31
  > }
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    32
  > """)
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    33
  > f.close()
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    34
  > EOF
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    35
  $ S=`cat s`
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    36
  $ M=`cat m`
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    37
  $ L=`cat l`
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    38
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    39
alignment of option descriptions in help
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    40
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    41
  $ cat <<EOF > .hg/hgrc
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    42
  > [extensions]
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    43
  > ja_ext = `pwd`/showoptlist.py
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    44
  > EOF
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    45
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    46
check alignment of option descriptions in help
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    47
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    48
  $ hg help showoptlist
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    49
  hg showoptlist 
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    50
  
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    51
  dummy command to show option descriptions
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    52
  
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    53
  options:
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    54
  
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    55
   -s --opt1 短名          short width
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    56
   -m --opt2 MIDDLE_       middle width
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    57
   -l --opt3 長い長い名前  long width
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    58
  
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    59
  use "hg -v help showoptlist" to show global options
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    60
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    61
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    62
  $ rm -f s; touch s
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    63
  $ rm -f m; touch m
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    64
  $ rm -f l; touch l
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    65
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    66
add files
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    67
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    68
  $ cp s $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    69
  $ hg add $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    70
  $ cp m $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    71
  $ hg add $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    72
  $ cp l $L
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    73
  $ hg add $L
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    74
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    75
commit(1)
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    76
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    77
  $ echo 'first line(1)' >> s; cp s $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    78
  $ echo 'first line(2)' >> m; cp m $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    79
  $ echo 'first line(3)' >> l; cp l $L
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    80
  $ hg commit -m 'first commit' -u $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    81
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    82
commit(2)
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    83
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    84
  $ echo 'second line(1)' >> s; cp s $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    85
  $ echo 'second line(2)' >> m; cp m $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    86
  $ echo 'second line(3)' >> l; cp l $L
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    87
  $ hg commit -m 'second commit' -u $M
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    88
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    89
commit(3)
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    90
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    91
  $ echo 'third line(1)' >> s; cp s $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    92
  $ echo 'third line(2)' >> m; cp m $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    93
  $ echo 'third line(3)' >> l; cp l $L
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    94
  $ hg commit -m 'third commit' -u $L
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    95
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    96
check alignment of user names in annotate
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    97
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    98
  $ hg annotate -u $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    99
          短名: first line(2)
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   100
       MIDDLE_: second line(2)
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   101
  長い長い名前: third line(2)
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   102
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   103
check alignment of filenames in diffstat
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   104
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   105
  $ hg diff -c tip --stat
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   106
   MIDDLE_      |  1 +
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   107
   短名         |  1 +
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   108
   長い長い名前 |  1 +
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   109
   3 files changed, 3 insertions(+), 0 deletions(-)
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   110
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   111
add branches/tags
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   112
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   113
  $ hg branch $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   114
  marked working directory as branch 短名
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   115
  $ hg tag $S
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   116
  $ hg branch $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   117
  marked working directory as branch MIDDLE_
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   118
  $ hg tag $M
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   119
  $ hg branch $L
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   120
  marked working directory as branch 長い長い名前
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   121
  $ hg tag $L
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   122
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   123
check alignment of branches
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   124
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   125
  $ hg tags
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   126
  tip                                5:d745ff46155b
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   127
  長い長い名前                       4:9259be597f19
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   128
  MIDDLE_                            3:b06c5b6def9e
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   129
  短名                               2:64a70663cee8
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   130
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   131
check alignment of tags
11611
4f5a6df2af92 i18n: use encoding.colwidth() for correct column width
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
   132
12418
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   133
  $ hg tags
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   134
  tip                                5:d745ff46155b
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   135
  長い長い名前                       4:9259be597f19
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   136
  MIDDLE_                            3:b06c5b6def9e
09c6dd129f82 tests: unify test-encoding-align
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   137
  短名                               2:64a70663cee8