summaryrefslogtreecommitdiff
path: root/tests/test_domain_cpp.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-21 02:21:59 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-21 02:21:59 +0900
commit86f0336693df45acdc2e968322bd794171e45eef (patch)
tree0faf30c4ce4e1c3a1acf3ad3d814848a4592110f /tests/test_domain_cpp.py
parente6cc18cc59e54a26d25c7ec54354b3dfa646c07b (diff)
parentb96a315b5f80c7127b5fad7c6c25ce3a1056ad48 (diff)
downloadsphinx-git-86f0336693df45acdc2e968322bd794171e45eef.tar.gz
Merge branch '2.0'
Diffstat (limited to 'tests/test_domain_cpp.py')
-rw-r--r--tests/test_domain_cpp.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py
index 0cd3445a5..46019b4a9 100644
--- a/tests/test_domain_cpp.py
+++ b/tests/test_domain_cpp.py
@@ -194,6 +194,8 @@ def test_expressions():
exprCheck('new int()', 'nw_ipiE')
exprCheck('new int(5, 42)', 'nw_ipiL5EL42EE')
exprCheck('::new int', 'nw_iE')
+ exprCheck('new int{}', 'nw_iilE')
+ exprCheck('new int{5, 42}', 'nw_iilL5EL42EE')
# delete-expression
exprCheck('delete p', 'dl1p')
exprCheck('delete [] p', 'da1p')
@@ -673,6 +675,40 @@ def test_template_args():
{2: "I0E21enable_if_not_array_t"})
+def test_initializers():
+ idsMember = {1: 'v__T', 2:'1v'}
+ idsFunction = {1: 'f__T', 2: '1f1T'}
+ idsTemplate = {2: 'I_1TE1fv', 4: 'I_1TE1fvv'}
+ # no init
+ check('member', 'T v', idsMember)
+ check('function', 'void f(T v)', idsFunction)
+ check('function', 'template<T v> void f()', idsTemplate)
+ # with '=', assignment-expression
+ check('member', 'T v = 42', idsMember)
+ check('function', 'void f(T v = 42)', idsFunction)
+ check('function', 'template<T v = 42> void f()', idsTemplate)
+ # with '=', braced-init
+ check('member', 'T v = {}', idsMember)
+ check('function', 'void f(T v = {})', idsFunction)
+ check('function', 'template<T v = {}> void f()', idsTemplate)
+ check('member', 'T v = {42, 42, 42}', idsMember)
+ check('function', 'void f(T v = {42, 42, 42})', idsFunction)
+ check('function', 'template<T v = {42, 42, 42}> void f()', idsTemplate)
+ check('member', 'T v = {42, 42, 42,}', idsMember)
+ check('function', 'void f(T v = {42, 42, 42,})', idsFunction)
+ check('function', 'template<T v = {42, 42, 42,}> void f()', idsTemplate)
+ check('member', 'T v = {42, 42, args...}', idsMember)
+ check('function', 'void f(T v = {42, 42, args...})', idsFunction)
+ check('function', 'template<T v = {42, 42, args...}> void f()', idsTemplate)
+ # without '=', braced-init
+ check('member', 'T v{}', idsMember)
+ check('member', 'T v{42, 42, 42}', idsMember)
+ check('member', 'T v{42, 42, 42,}', idsMember)
+ check('member', 'T v{42, 42, args...}', idsMember)
+ # other
+ check('member', 'T v = T{}', idsMember)
+
+
def test_attributes():
# style: C++
check('member', '[[]] int f', {1: 'f__i', 2: '1f'})