diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:25:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:25:40 +0000 |
commit | cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch) | |
tree | 18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/roots/test-domain-cpp | |
parent | Initial commit. (diff) | |
download | sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.tar.xz sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.zip |
Adding upstream version 7.2.6.upstream/7.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots/test-domain-cpp')
-rw-r--r-- | tests/roots/test-domain-cpp/anon-dup-decl.rst | 4 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/any-role.rst | 17 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/backslash.rst | 1 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/conf.py | 1 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/field-role.rst | 5 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/index.rst | 53 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/lookup-key-overload.rst | 8 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/multi-decl-lookup.rst | 24 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/roles-targets-ok.rst | 170 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/roles-targets-warn.rst | 158 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/roles.rst | 17 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/roles2.rst | 5 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/semicolon.rst | 14 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst | 11 | ||||
-rw-r--r-- | tests/roots/test-domain-cpp/xref_consistency.rst | 12 |
15 files changed, 500 insertions, 0 deletions
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` |