summaryrefslogtreecommitdiff
path: root/tests/test_domain_cpp.py
diff options
context:
space:
mode:
authorJakob Lykke Andersen <Jakob@caput.dk>2015-09-05 14:49:14 +0200
committerJakob Lykke Andersen <Jakob@caput.dk>2015-09-06 15:36:58 +0200
commit89c3dd81c371c4fe79f76a152efec0ef0b0bc704 (patch)
tree49f17c9707e9d80d7945e71331c63819a80a1cd4 /tests/test_domain_cpp.py
parented29c298a66df9e1293484b9f0dd60a25cac52fe (diff)
downloadsphinx-git-89c3dd81c371c4fe79f76a152efec0ef0b0bc704.tar.gz
C++, support for templates.
Fixes sphinx-doc/sphinx#1729.
Diffstat (limited to 'tests/test_domain_cpp.py')
-rw-r--r--tests/test_domain_cpp.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py
index 4f773156b..c13de0b4f 100644
--- a/tests/test_domain_cpp.py
+++ b/tests/test_domain_cpp.py
@@ -237,10 +237,27 @@ def test_templates():
check('class', "template<> A", None, "IE1A")
check('function', "template<> void A()", None, "IE1Av")
check('member', "template<> A a", None, "IE1a")
- check('type', "template<> A a", None, "IE1a")
+ check('type', "template<> a = A", None, "IE1a")
raises(DefinitionError, parse, 'enum', "template<> A")
raises(DefinitionError, parse, 'enumerator', "template<> A")
# then all the real tests
+ check('class', "template<typename T1, typename T2> A", None, "I00E1A")
+ check('type', "template<> a", None, "IE1a")
+
+ check('class', "template<typename T> A", None, "I0E1A")
+ check('class', "template<class T> A", None, "I0E1A")
+ check('class', "template<typename ...T> A", None, "IDpE1A")
+ check('class', "template<typename...> A", None, "IDpE1A")
+ check('class', "template<typename = Test> A", None, "I0E1A")
+ check('class', "template<typename T = Test> A", None, "I0E1A")
+
+ check('class', "template<template<typename> typename T> A",
+ None, "II0E0E1A")
+ check('class', "template<int> A", None, "I_iE1A")
+ check('class', "template<int T> A", None, "I_iE1A")
+ check('class', "template<int... T> A", None, "I_DpiE1A")
+ check('class', "template<int T = 42> A", None, "I_iE1A")
+ check('class', "template<int = 42> A", None, "I_iE1A")
def test_bases():
@@ -252,6 +269,7 @@ def test_bases():
check('class', 'A : B, C', "A", "1A")
check('class', 'A : B, protected C, D', "A", "1A")
+
def test_operators():
check('function', 'void operator new [ ] ()',
"new-array-operator", "nav", output='void operator new[]()')