summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-domain-cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:31:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:31:33 +0000
commite863fd965dd6253243c3342bd6f0adc4fc8aec4d (patch)
treea4c1b6491a82593950043c3f8b2530e80664d768 /tests/roots/test-domain-cpp
parentInitial commit. (diff)
downloadsphinx-e863fd965dd6253243c3342bd6f0adc4fc8aec4d.tar.xz
sphinx-e863fd965dd6253243c3342bd6f0adc4fc8aec4d.zip
Adding upstream version 5.3.0.upstream/5.3.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/roots/test-domain-cpp-intersphinx/conf.py4
-rw-r--r--tests/roots/test-domain-cpp-intersphinx/index.rst112
-rw-r--r--tests/roots/test-domain-cpp/anon-dup-decl.rst4
-rw-r--r--tests/roots/test-domain-cpp/any-role.rst17
-rw-r--r--tests/roots/test-domain-cpp/backslash.rst1
-rw-r--r--tests/roots/test-domain-cpp/conf.py1
-rw-r--r--tests/roots/test-domain-cpp/field-role.rst5
-rw-r--r--tests/roots/test-domain-cpp/index.rst53
-rw-r--r--tests/roots/test-domain-cpp/lookup-key-overload.rst8
-rw-r--r--tests/roots/test-domain-cpp/multi-decl-lookup.rst24
-rw-r--r--tests/roots/test-domain-cpp/roles-targets-ok.rst170
-rw-r--r--tests/roots/test-domain-cpp/roles-targets-warn.rst158
-rw-r--r--tests/roots/test-domain-cpp/roles.rst17
-rw-r--r--tests/roots/test-domain-cpp/roles2.rst5
-rw-r--r--tests/roots/test-domain-cpp/semicolon.rst14
-rw-r--r--tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst11
-rw-r--r--tests/roots/test-domain-cpp/xref_consistency.rst12
17 files changed, 616 insertions, 0 deletions
diff --git a/tests/roots/test-domain-cpp-intersphinx/conf.py b/tests/roots/test-domain-cpp-intersphinx/conf.py
new file mode 100644
index 0000000..c176af7
--- /dev/null
+++ b/tests/roots/test-domain-cpp-intersphinx/conf.py
@@ -0,0 +1,4 @@
+exclude_patterns = ['_build']
+extensions = [
+ 'sphinx.ext.intersphinx',
+]
diff --git a/tests/roots/test-domain-cpp-intersphinx/index.rst b/tests/roots/test-domain-cpp-intersphinx/index.rst
new file mode 100644
index 0000000..9ed9493
--- /dev/null
+++ b/tests/roots/test-domain-cpp-intersphinx/index.rst
@@ -0,0 +1,112 @@
+.. cpp:type:: _class __class
+
+ - :any:`_class`
+ - :cpp:any:`_class`
+ - :cpp:class:`_class`
+ - :cpp:struct:`_class`
+ - :cpp:type:`_class`
+
+.. cpp:type:: _struct __struct
+
+ - :any:`_struct`
+ - :cpp:any:`_struct`
+ - :cpp:class:`_struct`
+ - :cpp:struct:`_struct`
+ - :cpp:type:`_struct`
+
+.. cpp:type:: _union __union
+
+ - :any:`_union`
+ - :cpp:any:`_union`
+ - :cpp:union:`_union`
+ - :cpp:type:`_union`
+
+.. cpp:member:: void __function = _function
+
+ - :any:`_function`
+ - :cpp:any:`_function`
+ - :cpp:func:`_function`
+ - :cpp:type:`_function`
+
+.. cpp:member:: void __member = _member
+
+ - :any:`_member`
+ - :cpp:any:`_member`
+ - :cpp:member:`_member`
+ - :cpp:var:`_member`
+
+.. cpp:member:: void __var = _var
+
+ - :any:`_var`
+ - :cpp:any:`_var`
+ - :cpp:member:`_var`
+ - :cpp:var:`_var`
+
+.. cpp:type:: _type __type
+
+ - :any:`_type`
+ - :cpp:any:`_type`
+ - :cpp:type:`_type`
+
+.. cpp:function:: template<_concept T> void __concept()
+
+ - :any:`_concept`
+ - :cpp:any:`_concept`
+ - :cpp:concept:`_concept`
+
+.. cpp:type:: _enum __enum
+
+ - :any:`_enum`
+ - :cpp:any:`_enum`
+ - :cpp:enum:`_enum`
+ - :cpp:type:`_enum`
+
+.. cpp:type:: _enumStruct __enumStruct
+
+ - :any:`_enumStruct`
+ - :cpp:any:`_enumStruct`
+ - :cpp:enum:`_enumStruct`
+ - :cpp:type:`_enumStruct`
+
+.. cpp:type:: _enumClass __enumClass
+
+ - :any:`_enumClass`
+ - :cpp:any:`_enumClass`
+ - :cpp:enum:`_enumClass`
+ - :cpp:type:`_enumClass`
+
+.. cpp:member:: void __enumerator = _enumerator
+
+ - :any:`_enumerator`
+ - :cpp:any:`_enumerator`
+ - :cpp:enumerator:`_enumerator`
+
+.. cpp:member:: void __scopedEnumerator = _enumStruct::_scopedEnumerator
+
+ - :any:`_enumStruct::_scopedEnumerator`
+ - :cpp:any:`_enumStruct::_scopedEnumerator`
+ - :cpp:enumerator:`_enumStruct::_scopedEnumerator`
+
+.. cpp:member:: void __enumerator2 = _enum::_enumerator
+
+ - :any:`_enum::_enumerator`
+ - :cpp:any:`_enum::_enumerator`
+ - :cpp:enumerator:`_enum::_enumerator`
+
+.. cpp:member:: void __functionParam = _functionParam::param
+
+ - :any:`_functionParam::param`
+ - :cpp:any:`_functionParam::param`
+ - :cpp:member:`_functionParam::param`
+ - :cpp:var:`_functionParam::param`
+
+.. cpp:type:: _templateParam::TParam __templateParam
+
+ - :any:`_templateParam::TParam`
+ - :cpp:any:`_templateParam::TParam`
+ - :cpp:type:`_templateParam::TParam`
+ - :cpp:member:`_templateParam::TParam`
+ - :cpp:var:`_templateParam::TParam`
+ - :cpp:class:`_templateParam::TParam`
+ - :cpp:struct:`_templateParam::TParam`
+ - :cpp:union:`_templateParam::TParam`
diff --git a/tests/roots/test-domain-cpp/anon-dup-decl.rst b/tests/roots/test-domain-cpp/anon-dup-decl.rst
new file mode 100644
index 0000000..89a9c95
--- /dev/null
+++ b/tests/roots/test-domain-cpp/anon-dup-decl.rst
@@ -0,0 +1,4 @@
+.. cpp:namespace:: anon_dup_decl
+.. cpp:class:: @a::A
+.. cpp:class:: @b::A
+.. cpp:class:: A
diff --git a/tests/roots/test-domain-cpp/any-role.rst b/tests/roots/test-domain-cpp/any-role.rst
new file mode 100644
index 0000000..24b415e
--- /dev/null
+++ b/tests/roots/test-domain-cpp/any-role.rst
@@ -0,0 +1,17 @@
+any role
+--------
+
+* :cpp:any:`Sphinx`
+* :cpp:any:`Sphinx::version`
+* :cpp:any:`version`
+* :cpp:any:`List`
+* :cpp:any:`MyEnum`
+
+* ref function without parens :cpp:any:`paren_1`
+* ref function with parens :cpp:any:`paren_2()`
+* ref function without parens, explicit title :cpp:any:`paren_3_title <paren_3>`
+* ref function with parens, explicit title :cpp:any:`paren_4_title <paren_4()>`
+* ref op call without parens :cpp:any:`paren_5::operator()`
+* ref op call with parens :cpp:any:`paren_6::operator()()`
+* ref op call without parens, explicit title :cpp:any:`paren_7_title <paren_7::operator()>`
+* ref op call with parens, explicit title :cpp:any:`paren_8_title <paren_8::operator()()>`
diff --git a/tests/roots/test-domain-cpp/backslash.rst b/tests/roots/test-domain-cpp/backslash.rst
new file mode 100644
index 0000000..c93e68e
--- /dev/null
+++ b/tests/roots/test-domain-cpp/backslash.rst
@@ -0,0 +1 @@
+.. cpp:var:: char c = '\\'
diff --git a/tests/roots/test-domain-cpp/conf.py b/tests/roots/test-domain-cpp/conf.py
new file mode 100644
index 0000000..a45d22e
--- /dev/null
+++ b/tests/roots/test-domain-cpp/conf.py
@@ -0,0 +1 @@
+exclude_patterns = ['_build']
diff --git a/tests/roots/test-domain-cpp/field-role.rst b/tests/roots/test-domain-cpp/field-role.rst
new file mode 100644
index 0000000..1711a88
--- /dev/null
+++ b/tests/roots/test-domain-cpp/field-role.rst
@@ -0,0 +1,5 @@
+.. cpp:function:: void f()
+
+ :throws int:
+ :throws int*:
+
diff --git a/tests/roots/test-domain-cpp/index.rst b/tests/roots/test-domain-cpp/index.rst
new file mode 100644
index 0000000..2df5ec8
--- /dev/null
+++ b/tests/roots/test-domain-cpp/index.rst
@@ -0,0 +1,53 @@
+test-domain-cpp
+===============
+
+directives
+----------
+
+.. cpp:class:: public Sphinx
+
+ The description of Sphinx class.
+
+.. cpp:function:: int hello(char *name)
+
+ The description of hello function.
+
+.. cpp:member:: float Sphinx::version
+
+ The description of Sphinx::version.
+
+.. cpp:var:: int version
+
+ The description of version.
+
+.. cpp:type:: std::vector<int> List
+
+ The description of List type.
+
+.. cpp:enum:: MyEnum
+
+ An unscoped enum.
+
+ .. cpp:enumerator:: A
+
+.. cpp:enum-class:: MyScopedEnum
+
+ A scoped enum.
+
+ .. cpp:enumerator:: B
+
+.. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type<MySpecificEnum>::type
+
+ A scoped enum with non-default visibility, and with a specified underlying type.
+
+ .. cpp:enumerator:: B
+
+
+.. cpp:function:: void paren_1(int, float)
+.. cpp:function:: void paren_2(int, float)
+.. cpp:function:: void paren_3(int, float)
+.. cpp:function:: void paren_4(int, float)
+.. cpp:function:: void paren_5::operator()(int)
+.. cpp:function:: void paren_6::operator()(int)
+.. cpp:function:: void paren_7::operator()(int)
+.. cpp:function:: void paren_8::operator()(int)
diff --git a/tests/roots/test-domain-cpp/lookup-key-overload.rst b/tests/roots/test-domain-cpp/lookup-key-overload.rst
new file mode 100644
index 0000000..2011e26
--- /dev/null
+++ b/tests/roots/test-domain-cpp/lookup-key-overload.rst
@@ -0,0 +1,8 @@
+.. default-domain:: cpp
+
+.. namespace:: lookup_key_overload
+
+.. function:: void g(int a)
+.. function:: void g(double b)
+
+ :var:`b`
diff --git a/tests/roots/test-domain-cpp/multi-decl-lookup.rst b/tests/roots/test-domain-cpp/multi-decl-lookup.rst
new file mode 100644
index 0000000..9706d18
--- /dev/null
+++ b/tests/roots/test-domain-cpp/multi-decl-lookup.rst
@@ -0,0 +1,24 @@
+.. default-domain:: cpp
+
+.. namespace:: multi_decl_lookup
+
+.. function:: void f1(int a)
+ void f1(double b)
+
+ - a: :var:`a`
+ - b: :var:`b`
+
+.. function:: template<typename T> void f2(int a)
+ template<typename U> void f2(double b)
+
+ - T: :type:`T`
+ - U: :type:`U`
+
+
+.. class:: template<typename T> A
+ template<typename U> B
+
+ .. function:: void f3()
+
+ - T: :type:`T`
+ - U: :type:`U`
diff --git a/tests/roots/test-domain-cpp/roles-targets-ok.rst b/tests/roots/test-domain-cpp/roles-targets-ok.rst
new file mode 100644
index 0000000..783f7b9
--- /dev/null
+++ b/tests/roots/test-domain-cpp/roles-targets-ok.rst
@@ -0,0 +1,170 @@
+.. default-domain:: cpp
+
+.. namespace:: RolesTargetsOk
+
+.. class:: Class
+
+ :cpp:any:`Class`
+ :class:`Class`
+ :struct:`Class`
+ union
+ func
+ member
+ var
+ :type:`Class`
+ concept
+ enum
+ enumerator
+
+.. union:: Union
+
+ :cpp:any:`Union`
+ class
+ struct
+ :union:`Union`
+ func
+ member
+ var
+ :type:`Union`
+ concept
+ enum
+ enumerator
+
+.. function:: void Function()
+
+ :cpp:any:`Function`
+ class
+ struct
+ union
+ :func:`Function`
+ member
+ var
+ :type:`Function`
+ concept
+ enum
+ enumerator
+
+.. var:: int Variable
+
+ :cpp:any:`Variable`
+ class
+ struct
+ union
+ function
+ :member:`Variable`
+ :var:`Variables`
+ type
+ concept
+ enum
+ enumerator
+
+.. type:: Type = void
+
+ :cpp:any:`Type`
+ class
+ struct
+ union
+ function
+ member
+ var
+ :type:`Type`
+ concept
+ enum
+ enumerator
+
+.. concept:: template<typename T> Concept
+
+ :cpp:any:`Concept`
+ class
+ struct
+ union
+ function
+ member
+ var
+ type
+ :concept:`Concept`
+ enum
+ enumerator
+
+.. enum-struct:: Enum
+
+ :cpp:any:`Enum`
+ class
+ struct
+ union
+ function
+ member
+ var
+ :type:`Enum`
+ concept
+ :enum:`Enum`
+ enumerator
+
+ .. enumerator:: Enumerator
+
+ :cpp:any:`Enumerator`
+ class
+ struct
+ union
+ function
+ member
+ var
+ type
+ concept
+ enum
+ :enumerator:`Enumerator`
+
+.. class:: template<typename TParamType, \
+ int TParamVar, \
+ template<typename> typename TParamTemplate \
+ > ClassTemplate
+
+ :cpp:any:`TParamType`
+ :class:`TParamType`
+ :struct:`TParamType`
+ :union:`TParamType`
+ function
+ :member:`TParamType`
+ :var:`TParamType`
+ :type:`TParamType`
+ concept
+ enum
+ enumerator
+
+ :cpp:any:`TParamVar`
+ :class:`TParamVar`
+ :struct:`TParamVar`
+ :union:`TParamVar`
+ function
+ :member:`TParamVar`
+ :var:`TParamVar`
+ :type:`TParamVar`
+ concept
+ enum
+ enumerator
+
+ :cpp:any:`TParamTemplate`
+ :class:`TParamTemplate`
+ :struct:`TParamTemplate`
+ :union:`TParamTemplate`
+ function
+ :member:`TParamTemplate`
+ :var:`TParamTemplate`
+ :type:`TParamTemplate`
+ concept
+ enum
+ enumerator
+
+.. function:: void FunctionParams(int FunctionParam)
+
+ :cpp:any:`FunctionParam`
+ class
+ struct
+ union
+ function
+ :member:`FunctionParam`
+ :var:`FunctionParam`
+ type
+ concept
+ enum
+ enumerator
diff --git a/tests/roots/test-domain-cpp/roles-targets-warn.rst b/tests/roots/test-domain-cpp/roles-targets-warn.rst
new file mode 100644
index 0000000..57083ff
--- /dev/null
+++ b/tests/roots/test-domain-cpp/roles-targets-warn.rst
@@ -0,0 +1,158 @@
+.. default-domain:: cpp
+
+.. namespace:: RolesTargetsWarn
+
+.. class:: Class
+
+ class
+ struct
+ :union:`Class`
+ :func:`Class`
+ :member:`Class`
+ :var:`Class`
+ type
+ :concept:`Class`
+ :enum:`Class`
+ :enumerator:`Class`
+
+.. union:: Union
+
+ :class:`Union`
+ :struct:`Union`
+ union
+ :func:`Union`
+ :member:`Union`
+ :var:`Union`
+ type
+ :concept:`Union`
+ :enum:`Union`
+ :enumerator:`Union`
+
+.. function:: void Function()
+
+ :class:`Function`
+ :struct:`Function`
+ :union:`Function`
+ func
+ :member:`Function`
+ :var:`Function`
+ type
+ :concept:`Function`
+ :enum:`Function`
+ :enumerator:`Function`
+
+.. var:: int Variable
+
+ :class:`Variable`
+ :struct:`Variable`
+ :union:`Variable`
+ :func:`Variable`
+ member
+ var
+ :type:`Variable`
+ :concept:`Variable`
+ :enum:`Variable`
+ :enumerator:`Variable`
+
+.. type:: Type = void
+
+ :class:`Type`
+ :struct:`Type`
+ :union:`Type`
+ :func:`Type`
+ :member:`Type`
+ :var:`Type`
+ type
+ :concept:`Type`
+ :enum:`Type`
+ :enumerator:`Type`
+
+.. concept:: template<typename T> Concept
+
+ :class:`Concept`
+ :struct:`Concept`
+ :union:`Concept`
+ :func:`Concept`
+ :member:`Concept`
+ :var:`Concept`
+ :type:`Concept`
+ concept
+ :enum:`Concept`
+ :enumerator:`Concept`
+
+.. enum-struct:: Enum
+
+ :class:`Enum`
+ :struct:`Enum`
+ :union:`Enum`
+ :func:`Enum`
+ :member:`Enum`
+ :var:`Enum`
+ type
+ :concept:`Enum`
+ enum
+ :enumerator:`Enum`
+
+ .. enumerator:: Enumerator
+
+ :class:`Enumerator`
+ :struct:`Enumerator`
+ :union:`Enumerator`
+ :func:`Enumerator`
+ :member:`Enumerator`
+ :var:`Enumerator`
+ :type:`Enumerator`
+ :concept:`Enumerator`
+ :enum:`Enumerator`
+ enumerator
+
+.. class:: template<typename TParamType, \
+ int TParamVar, \
+ template<typename> typename TParamTemplate \
+ > ClassTemplate
+
+ class
+ struct
+ union
+ :func:`TParamType`
+ member
+ var
+ type
+ :concept:`TParamType`
+ :enum:`TParamType`
+ :enumerator:`TParamType`
+
+ class
+ struct
+ union
+ :func:`TParamVar`
+ member
+ var
+ type
+ :concept:`TParamVar`
+ :enum:`TParamVar`
+ :enumerator:`TParamVar`
+
+ class
+ struct
+ union
+ :func:`TParamTemplate`
+ member
+ var
+ type
+ :concept:`TParamTemplate`
+ :enum:`TParamTemplate`
+ :enumerator:`TParamTemplate`
+
+.. function:: void FunctionParams(int FunctionParam)
+
+ :class:`FunctionParam`
+ :struct:`FunctionParam`
+ :union:`FunctionParam`
+ :func:`FunctionParam`
+ member
+ var
+ :type:`FunctionParam`
+ :concept:`FunctionParam`
+ :enum:`FunctionParam`
+ :enumerator:`FunctionParam`
diff --git a/tests/roots/test-domain-cpp/roles.rst b/tests/roots/test-domain-cpp/roles.rst
new file mode 100644
index 0000000..afd2ede
--- /dev/null
+++ b/tests/roots/test-domain-cpp/roles.rst
@@ -0,0 +1,17 @@
+roles
+-----
+
+* :cpp:class:`Sphinx`
+* :cpp:member:`Sphinx::version`
+* :cpp:var:`version`
+* :cpp:type:`List`
+* :cpp:enum:`MyEnum`
+
+* ref function without parens :cpp:func:`paren_1`
+* ref function with parens :cpp:func:`paren_2()`
+* ref function without parens, explicit title :cpp:func:`paren_3_title <paren_3>`
+* ref function with parens, explicit title :cpp:func:`paren_4_title <paren_4()>`
+* ref op call without parens :cpp:func:`paren_5::operator()`
+* ref op call with parens :cpp:func:`paren_6::operator()()`
+* ref op call without parens, explicit title :cpp:func:`paren_7_title <paren_7::operator()>`
+* ref op call with parens, explicit title :cpp:func:`paren_8_title <paren_8::operator()()>`
diff --git a/tests/roots/test-domain-cpp/roles2.rst b/tests/roots/test-domain-cpp/roles2.rst
new file mode 100644
index 0000000..644b827
--- /dev/null
+++ b/tests/roots/test-domain-cpp/roles2.rst
@@ -0,0 +1,5 @@
+Check that we don't crash just because we misuse a role.
+
+.. cpp:class:: A
+
+:cpp:func:`A`
diff --git a/tests/roots/test-domain-cpp/semicolon.rst b/tests/roots/test-domain-cpp/semicolon.rst
new file mode 100644
index 0000000..e6b370e
--- /dev/null
+++ b/tests/roots/test-domain-cpp/semicolon.rst
@@ -0,0 +1,14 @@
+.. cpp:class:: Class;
+.. cpp:struct:: Struct;
+.. cpp:union:: Union;
+.. cpp:function:: void f();
+.. cpp:member:: int member;
+.. cpp:var:: int var;
+.. cpp:type:: Type;
+.. cpp:type:: int TypeDef;
+.. cpp:type:: Alias = int;
+.. cpp:concept:: template<typename T> Concept;
+.. cpp:enum:: Enum;
+.. cpp:enum-struct:: EnumStruct;
+.. cpp:enum-class:: EnumClass;
+.. cpp:enumerator:: Enumerator;
diff --git a/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst b/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst
new file mode 100644
index 0000000..49a650d
--- /dev/null
+++ b/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst
@@ -0,0 +1,11 @@
+.. default-domain:: cpp
+
+.. class:: template<typename T> A
+
+ .. type:: N1 = T::typeOk
+
+ - Not ok, warn: :type:`T::typeWarn`
+
+ .. type:: N2 = T::U::typeOk
+
+ - Not ok, warn: :type:`T::U::typeWarn`
diff --git a/tests/roots/test-domain-cpp/xref_consistency.rst b/tests/roots/test-domain-cpp/xref_consistency.rst
new file mode 100644
index 0000000..cb33000
--- /dev/null
+++ b/tests/roots/test-domain-cpp/xref_consistency.rst
@@ -0,0 +1,12 @@
+xref consistency
+----------------
+
+.. cpp:namespace:: xref_consistency
+
+.. cpp:class:: item
+
+code-role: :code:`item`
+any-role: :any:`item`
+cpp-any-role: :cpp:any:`item`
+cpp-expr-role: :cpp:expr:`item`
+cpp-texpr-role: :cpp:texpr:`item`