changeset 35169:d2eff9d4db3f

tests: move JSON escape test to test-hgweb-json.t The original tests (kanji and null) in test-hgweb-commands.t come from aff419e260f9 and 823a7d79ef82, but they check json escape filter by using JavaScript variable on /graph page, which is awkward, and I'm planning to remove commit description from this variable soon. Let's move the parts that check json template filter to a more appropriate file and use normal json-* templates.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 30 Nov 2017 16:30:43 +0800
parents 3da4bd50103d
children e6487522ef92
files tests/test-hgweb-commands.t tests/test-hgweb-json.t
diffstat 2 files changed, 25 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-hgweb-commands.t	Wed Nov 29 07:57:17 2017 +0530
+++ b/tests/test-hgweb-commands.t	Thu Nov 30 16:30:43 2017 +0800
@@ -2126,27 +2126,6 @@
   
   
 
-Stop and restart with HGENCODING=cp932 and preferuncompressed
-
-  $ killdaemons.py
-  $ HGENCODING=cp932 hg serve --config server.preferuncompressed=True -n test \
-  >     -p $HGPORT -d --pid-file=hg.pid -E errors.log
-  $ cat hg.pid >> $DAEMON_PIDS
-
-commit message with Japanese Kanji 'Noh', which ends with '\x5c'
-
-  $ echo foo >> foo
-  $ HGENCODING=cp932 hg ci -m `$PYTHON -c 'print("\x94\x5c")'`
-
-Graph json escape of multibyte character
-
-  $ get-with-headers.py $LOCALIP:$HGPORT 'graph/' > out
-  >>> from __future__ import print_function
-  >>> for line in open("out"):
-  ...     if line.startswith("var data ="):
-  ...         print(line, end='')
-  var data = [["061dd13ba3c3", [0, 1], [[0, 0, 1, -1, ""]], "\u80fd", "test", "1970-01-01", ["unstable", true], ["tip"], ["something"]], ["cad8025a2e87", [0, 1], [[0, 0, 1, 3, "FF0000"]], "branch commit with null character: \u0000", "test", "1970-01-01", ["unstable", false], [], []], ["1d22e65f027e", [0, 1], [[0, 0, 1, 3, ""]], "branch", "test", "1970-01-01", ["stable", true], [], []], ["a4f92ed23982", [0, 1], [[0, 0, 1, 3, ""]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "1970-01-01", ["default", true], [], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "1970-01-01", ["default", false], ["1.0"], ["anotherthing"]]];
-
 capabilities
 
 (plain version to check the format)
--- a/tests/test-hgweb-json.t	Wed Nov 29 07:57:17 2017 +0530
+++ b/tests/test-hgweb-json.t	Thu Nov 30 16:30:43 2017 +0800
@@ -1648,3 +1648,28 @@
     "rawdoc": "Working with Phases\n*", (glob)
     "topic": "phases"
   }
+
+Commit message with Japanese Kanji 'Noh', which ends with '\x5c'
+
+  $ echo foo >> da/foo
+  $ HGENCODING=cp932 hg ci -m `$PYTHON -c 'print("\x94\x5c")'`
+
+Commit message with null character
+
+  $ echo foo >> da/foo
+  >>> open('msg', 'wb').write('commit with null character: \0\n')
+  $ hg ci -l msg
+  $ rm msg
+
+Stop and restart with HGENCODING=cp932
+
+  $ killdaemons.py
+  $ HGENCODING=cp932 hg serve -p $HGPORT -d --pid-file=hg.pid \
+  > -A access.log -E error.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+Test json escape of multibyte characters
+
+  $ request json-filelog/tip/da/foo?revcount=2 | grep '"desc":'
+        "desc": "commit with null character: \u0000",
+        "desc": "\u80fd",