Mercurial > hg
comparison tests/test-bad-extension.t @ 28083:550097d01ca3
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.
author | Simon Farnsworth <simonfar@fb.com> |
---|---|
date | Fri, 12 Feb 2016 06:25:05 -0800 |
parents | 50ad3f25fb4c |
children | 7f430b2ac7fd |
comparison
equal
deleted
inserted
replaced
28082:db90cb1e89c8 | 28083:550097d01ca3 |
---|---|
1 $ echo 'raise Exception("bit bucket overflow")' > badext.py | 1 $ echo 'raise Exception("bit bucket overflow")' > badext.py |
2 $ abspath=`pwd`/badext.py | 2 $ abspathexc=`pwd`/badext.py |
3 | |
4 $ cat >baddocext.py <<EOF | |
5 > """ | |
6 > baddocext is bad | |
7 > """ | |
8 > EOF | |
9 $ abspathdoc=`pwd`/baddocext.py | |
3 | 10 |
4 $ cat <<EOF >> $HGRCPATH | 11 $ cat <<EOF >> $HGRCPATH |
5 > [extensions] | 12 > [extensions] |
6 > gpg = | 13 > gpg = |
7 > hgext.gpg = | 14 > hgext.gpg = |
8 > badext = $abspath | 15 > badext = $abspathexc |
16 > baddocext = $abspathdoc | |
9 > badext2 = | 17 > badext2 = |
10 > EOF | 18 > EOF |
11 | 19 |
12 $ hg -q help help 2>&1 |grep extension | 20 $ hg -q help help 2>&1 |grep extension |
13 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow | 21 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
36 Traceback (most recent call last): | 44 Traceback (most recent call last): |
37 ImportError: No module named *badext2 (glob) | 45 ImportError: No module named *badext2 (glob) |
38 *** failed to import extension badext2: No module named badext2 | 46 *** failed to import extension badext2: No module named badext2 |
39 Traceback (most recent call last): | 47 Traceback (most recent call last): |
40 ImportError: No module named badext2 | 48 ImportError: No module named badext2 |
49 | |
50 confirm that there's no crash when an extension's documentation is bad | |
51 | |
52 $ hg help --keyword baddocext | |
53 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow | |
54 *** failed to import extension badext2: No module named badext2 | |
55 Topics: | |
56 | |
57 extensions Using Additional Features |