summaryrefslogtreecommitdiff
path: root/tests/test_domain_cpp.py
diff options
context:
space:
mode:
authorJakob Lykke Andersen <Jakob@caput.dk>2019-10-06 11:20:00 +0200
committerJakob Lykke Andersen <Jakob@caput.dk>2019-10-06 11:23:47 +0200
commit96712670091e3d2093e0313f23426d8c45050df8 (patch)
treed9b1d841994b525ade2894d208002fcd3eae97a9 /tests/test_domain_cpp.py
parente8963e84ed593461825a4fbcc7077b4f53a65e04 (diff)
downloadsphinx-git-96712670091e3d2093e0313f23426d8c45050df8.tar.gz
C++, support bit-fields
Fixes sphinx-doc/sphinx#6707
Diffstat (limited to 'tests/test_domain_cpp.py')
-rw-r--r--tests/test_domain_cpp.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py
index bbb4cc55e..df1e1bae1 100644
--- a/tests/test_domain_cpp.py
+++ b/tests/test_domain_cpp.py
@@ -334,6 +334,16 @@ def test_member_definitions():
check('member', 'thread_local extern int myInt', {1: 'myInt__i', 2: '5myInt'},
'extern thread_local int myInt')
+ # tests based on https://en.cppreference.com/w/cpp/language/bit_field
+ check('member', 'int b : 3', {1: 'b__i', 2: '1b'})
+ check('member', 'int b : 8 = 42', {1: 'b__i', 2: '1b'})
+ check('member', 'int b : 8{42}', {1: 'b__i', 2: '1b'})
+ # TODO: enable once the ternary operator is supported
+ #check('member', 'int b : true ? 8 : a = 42', {1: 'b__i', 2: '1b'})
+ # TODO: enable once the ternary operator is supported
+ #check('member', 'int b : (true ? 8 : a) = 42', {1: 'b__i', 2: '1b'})
+ check('member', 'int b : 1 || new int{0}', {1: 'b__i', 2: '1b'})
+
def test_function_definitions():
check('function', 'void f(volatile int)', {1: "f__iV", 2: "1fVi"})