tests/test-extension.t
changeset 29851 4435d4c951ec
parent 29850 110ed1868f86
child 29873 0a9cd6e324cd
--- a/tests/test-extension.t	Tue Aug 16 16:09:12 2016 +0900
+++ b/tests/test-extension.t	Thu Aug 25 01:00:26 2016 -0400
@@ -1240,6 +1240,39 @@
   $ hg version -q --config extensions.throw=throw.py
   Mercurial Distributed SCM (version *) (glob)
 
+Test JSON output of version:
+
+  $ hg version -Tjson
+  [
+   {
+    "extensions": [],
+    "ver": "*" (glob)
+   }
+  ]
+
+  $ hg version --config extensions.throw=throw.py -Tjson
+  [
+   {
+    "extensions": [{"name": "throw", "place": "external", "ver": "1.twentythree"}],
+    "ver": "3.2.2"
+   }
+  ]
+
+  $ LANGUAGE= LC_ALL=ja_JP.UTF-8 hg version --config extensions.strip= -Tjson
+  [
+   {
+    "extensions": [{"name": "strip", "place": "internal", "ver": null}],
+    "ver": "*" (glob)
+   }
+  ]
+
+Test template output of version:
+
+  $ hg version --config extensions.throw=throw.py --config extensions.strip= \
+  > -T'{extensions % "{name}  {pad(ver, 16)}  ({place})\n"}'
+  throw  1.twentythree     (external)
+  strip                    (internal)
+
 Refuse to load extensions with minimum version requirements
 
   $ cat > minversion1.py << EOF