tests/test-encoding
author Matt Mackall <mpm@selenic.com>
Mon, 04 Dec 2006 14:32:02 -0600
changeset 3783 4421cef5d3f0
parent 3780 d0a48313b0f6
child 3789 734b1d6ba3dc
permissions -rwxr-xr-x
Make quoting in test-encoding simpler
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     1
#!/bin/sh
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     2
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     3
hg init t
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     4
cd t
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     5
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     6
# we need a repo with some legacy latin-1 changesets
3780
d0a48313b0f6 test-encoding: copy a bundle from TESTDIR rather than constructing one
Matt Mackall <mpm@selenic.com>
parents: 3779
diff changeset
     7
hg unbundle $TESTDIR/legacy-encoding.hg
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     8
hg co
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     9
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    10
printf "latin-1 e' encoded: \xe9" > latin-1
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    11
printf "utf-8 e' encoded: \xc3\xa9" > utf-8
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    12
printf "\xe9" > latin-1-tag
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    13
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    14
echo % should fail with encoding error
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    15
echo "plain old ascii" > a
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    16
hg st
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    17
HGENCODING=ascii hg ci -l latin-1 -d "0 0"
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    18
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    19
echo % these should work
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    20
echo "latin-1" > a
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    21
HGENCODING=latin-1 hg ci -l latin-1 -d "0 0"
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    22
echo "utf-8" > a
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    23
HGENCODING=utf-8 hg ci -l utf-8 -d "0 0"
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    24
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    25
HGENCODING=latin-1 hg tag -d "0 0" `cat latin-1-tag`
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    26
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    27
echo % ascii
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    28
hg --encoding ascii log
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    29
echo % latin-1
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    30
hg --encoding latin-1 log
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    31
echo % utf-8
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    32
hg --encoding utf-8 log
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    33
echo % ascii
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    34
HGENCODING=ascii hg tags
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    35
echo % latin-1
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    36
HGENCODING=latin-1 hg tags
3783
4421cef5d3f0 Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents: 3780
diff changeset
    37
echo % utf-8
3777
5da370c2f72d Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    38
HGENCODING=utf-8 hg tags