tests: confirm that a badly documented extension doesn't cause a crash
authorSimon Farnsworth <simonfar@fb.com>
Fri, 12 Feb 2016 06:25:05 -0800
changeset 28083 550097d01ca3
parent 28082 db90cb1e89c8
child 28084 3fc45956c978
tests: confirm that a badly documented extension doesn't cause a crash An external extension whose docstring doesn't conform to Mercurial standards used to cause crashes. Test that we omit such extensions when you do a keyword search.
tests/test-bad-extension.t
--- a/tests/test-bad-extension.t	Fri Feb 12 14:24:48 2016 +0000
+++ b/tests/test-bad-extension.t	Fri Feb 12 06:25:05 2016 -0800
@@ -1,11 +1,19 @@
   $ echo 'raise Exception("bit bucket overflow")' > badext.py
-  $ abspath=`pwd`/badext.py
+  $ abspathexc=`pwd`/badext.py
+
+  $ cat >baddocext.py <<EOF
+  > """
+  > baddocext is bad
+  > """
+  > EOF
+  $ abspathdoc=`pwd`/baddocext.py
 
   $ cat <<EOF >> $HGRCPATH
   > [extensions]
   > gpg =
   > hgext.gpg =
-  > badext = $abspath
+  > badext = $abspathexc
+  > baddocext = $abspathdoc
   > badext2 =
   > EOF
 
@@ -38,3 +46,12 @@
   *** failed to import extension badext2: No module named badext2
   Traceback (most recent call last):
   ImportError: No module named badext2
+
+confirm that there's no crash when an extension's documentation is bad
+
+  $ hg help --keyword baddocext
+  *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+  *** failed to import extension badext2: No module named badext2
+  Topics:
+  
+   extensions Using Additional Features