Mercurial > hg
annotate tests/test-alias @ 11765:aff419e260f9 stable
templatefilters: make json filter handle multibyte characters correctly
It aims to fix javascript error of hgweb's graph view in Japanese 'cp932'
encoding.
'cp932' contains multibyte characters ending with '\x5c' (backslash),
e.g. '\x94\x5c' for Japanese Kanji 'Noh'.
Due to json filter escapes '\' to '\\', multibyte string ending with
'\x5c' is translated to "xxx\", resulting javascript parse error on
a web browser.
This patch changes json() to pass unicode to jsonescape().
Unicode decoding error handler changed to 'replace' by Patrick Mézard.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 07 Aug 2010 16:27:16 +0900 |
parents | e4357c214bf1 |
children | c5e555e064d0 |
rev | line source |
---|---|
4801 | 1 #!/bin/sh |
2 | |
5523
5db730475d6d
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4801
diff
changeset
|
3 cat >> $HGRCPATH <<EOF |
4801 | 4 [alias] |
5 myinit = init | |
6 cleanstatus = status -c | |
7 unknown = bargle | |
8 ambiguous = s | |
9 recursive = recursive | |
8655 | 10 nodefinition = |
8477
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
11 mylog = log |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
12 lognull = log -r null |
8519
5fbee915ea5d
alias: a0104303f400 did not correctly handle whitespace in the args
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8477
diff
changeset
|
13 shortlog = log --template '{rev} {node|short} | {date|isodate}\n' |
8655 | 14 dln = lognull --debug |
9993
8bce1e0d2801
alias: do not crash when aliased command has no usage help text
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
8655
diff
changeset
|
15 nousage = rollback |
11460
9e250c145c38
test-alias: don't use the environment variable PWD
Mads Kiilerich <mads@kiilerich.com>
parents:
10793
diff
changeset
|
16 put = export -r 0 -o "\$FOO/%R.diff" |
11676
e4357c214bf1
alias: ensure checksignature() is applied directly to the command (issue2286)
Brodie Rao <brodie@bitheap.org>
parents:
11460
diff
changeset
|
17 rt = root |
8477
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
18 |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
19 [defaults] |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
20 mylog = -q |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
21 lognull = -q |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
22 log = -v |
4801 | 23 EOF |
24 | |
25 echo '% basic' | |
26 hg myinit alias | |
27 | |
28 echo '% unknown' | |
29 hg unknown | |
10021
0022f5c5459e
help: don't display bogus help messages for invalid aliases
Brodie Rao <me+hg@dackz.net>
parents:
9993
diff
changeset
|
30 hg help unknown |
4801 | 31 |
32 echo '% ambiguous' | |
33 hg ambiguous | |
10021
0022f5c5459e
help: don't display bogus help messages for invalid aliases
Brodie Rao <me+hg@dackz.net>
parents:
9993
diff
changeset
|
34 hg help ambiguous |
4801 | 35 |
36 echo '% recursive' | |
37 hg recursive | |
10021
0022f5c5459e
help: don't display bogus help messages for invalid aliases
Brodie Rao <me+hg@dackz.net>
parents:
9993
diff
changeset
|
38 hg help recursive |
4801 | 39 |
8655 | 40 echo '% no definition' |
41 hg nodef | |
10021
0022f5c5459e
help: don't display bogus help messages for invalid aliases
Brodie Rao <me+hg@dackz.net>
parents:
9993
diff
changeset
|
42 hg help nodef |
8655 | 43 |
4801 | 44 cd alias |
9993
8bce1e0d2801
alias: do not crash when aliased command has no usage help text
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
8655
diff
changeset
|
45 |
8bce1e0d2801
alias: do not crash when aliased command has no usage help text
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
8655
diff
changeset
|
46 echo '% no usage' |
8bce1e0d2801
alias: do not crash when aliased command has no usage help text
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
8655
diff
changeset
|
47 hg nousage |
8bce1e0d2801
alias: do not crash when aliased command has no usage help text
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
8655
diff
changeset
|
48 |
4801 | 49 echo foo > foo |
50 hg ci -Amfoo | |
51 | |
52 echo '% with opts' | |
53 hg cleanst | |
8477
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
54 |
8519
5fbee915ea5d
alias: a0104303f400 did not correctly handle whitespace in the args
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8477
diff
changeset
|
55 echo '% with opts and whitespace' |
5fbee915ea5d
alias: a0104303f400 did not correctly handle whitespace in the args
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8477
diff
changeset
|
56 hg shortlog |
5fbee915ea5d
alias: a0104303f400 did not correctly handle whitespace in the args
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8477
diff
changeset
|
57 |
8477
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
58 echo '% interaction with defaults' |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
59 hg mylog |
a0104303f400
alias: honor the [defaults] section, fix issue1642
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5523
diff
changeset
|
60 hg lognull |
8655 | 61 |
62 echo '% properly recursive' | |
63 hg dln | |
10793
16df09a54113
expand paths in aliases
Alexander Solovyov <piranha@piranha.org.ua>
parents:
10021
diff
changeset
|
64 |
16df09a54113
expand paths in aliases
Alexander Solovyov <piranha@piranha.org.ua>
parents:
10021
diff
changeset
|
65 echo '% path expanding' |
11460
9e250c145c38
test-alias: don't use the environment variable PWD
Mads Kiilerich <mads@kiilerich.com>
parents:
10793
diff
changeset
|
66 FOO=`pwd` hg put |
10793
16df09a54113
expand paths in aliases
Alexander Solovyov <piranha@piranha.org.ua>
parents:
10021
diff
changeset
|
67 cat 0.diff |
11676
e4357c214bf1
alias: ensure checksignature() is applied directly to the command (issue2286)
Brodie Rao <brodie@bitheap.org>
parents:
11460
diff
changeset
|
68 |
e4357c214bf1
alias: ensure checksignature() is applied directly to the command (issue2286)
Brodie Rao <brodie@bitheap.org>
parents:
11460
diff
changeset
|
69 echo '% invalid arguments' |
e4357c214bf1
alias: ensure checksignature() is applied directly to the command (issue2286)
Brodie Rao <brodie@bitheap.org>
parents:
11460
diff
changeset
|
70 hg rt foo |
e4357c214bf1
alias: ensure checksignature() is applied directly to the command (issue2286)
Brodie Rao <brodie@bitheap.org>
parents:
11460
diff
changeset
|
71 |
e4357c214bf1
alias: ensure checksignature() is applied directly to the command (issue2286)
Brodie Rao <brodie@bitheap.org>
parents:
11460
diff
changeset
|
72 exit 0 |