File: test_cpp.py

package info (click to toggle)
taskflow 3.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 45,948 kB
  • sloc: cpp: 39,058; xml: 35,572; python: 12,935; javascript: 1,732; makefile: 59; sh: 16
file content (108 lines) | stat: -rw-r--r-- 5,411 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
#   This file is part of m.css.
#
#   Copyright © 2017, 2018, 2019, 2020, 2021, 2022, 2023
#             Vladimír Vondruš <mosra@centrum.cz>
#
#   Permission is hereby granted, free of charge, to any person obtaining a
#   copy of this software and associated documentation files (the "Software"),
#   to deal in the Software without restriction, including without limitation
#   the rights to use, copy, modify, merge, publish, distribute, sublicense,
#   and/or sell copies of the Software, and to permit persons to whom the
#   Software is furnished to do so, subject to the following conditions:
#
#   The above copyright notice and this permission notice shall be included
#   in all copies or substantial portions of the Software.
#
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
#   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
#   DEALINGS IN THE SOFTWARE.
#

import unittest

from distutils.version import LooseVersion

from . import IntegrationTestCase, doxygen_version

class EnumClass(IntegrationTestCase):
    @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"),
                         "https://github.com/doxygen/doxygen/pull/627")
    def test(self):
        self.run_doxygen(wildcard='File_8h.xml')
        self.assertEqual(*self.actual_expected_contents('File_8h.html'))

class TemplateAlias(IntegrationTestCase):
    @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"),
                         "https://github.com/doxygen/doxygen/pull/626")
    def test(self):
        self.run_doxygen(wildcard='*.xml')
        self.assertEqual(*self.actual_expected_contents('File_8h.html'))
        self.assertEqual(*self.actual_expected_contents('structTemplate.html'))

class Derived(IntegrationTestCase):
    def test(self):
        self.run_doxygen(wildcard='*.xml')
        self.assertEqual(*self.actual_expected_contents('classNamespace_1_1A.html'))
        self.assertEqual(*self.actual_expected_contents('classNamespace_1_1PrivateBase.html'))
        self.assertEqual(*self.actual_expected_contents('classAnother_1_1ProtectedBase.html'))
        self.assertEqual(*self.actual_expected_contents('classNamespace_1_1VirtualBase.html'))
        self.assertEqual(*self.actual_expected_contents('classBaseOutsideANamespace.html'))
        self.assertEqual(*self.actual_expected_contents('classDerivedOutsideANamespace.html'))
        self.assertEqual(*self.actual_expected_contents('structAnother_1_1Final.html'))
        # For the final label in the tree
        self.assertEqual(*self.actual_expected_contents('annotated.html'))

class Friends(IntegrationTestCase):
    @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.13"),
                         "1.8.13 produces invalid XML for friend declarations")
    def test(self):
        self.run_doxygen(wildcard='class*.xml')
        self.assertEqual(*self.actual_expected_contents('classClass.html'))
        self.assertEqual(*self.actual_expected_contents('classTemplate.html'))

    def test_warnings(self):
        with self.assertLogs() as cm:
            self.run_doxygen(wildcard='structWarning.xml')
        self.assertEqual(*self.actual_expected_contents('structWarning.html'))
        self.assertEqual(cm.output, [
            "WARNING:root:structWarning.xml: doxygen is unable to cross-link friend class GroupedFriendClassWarning, ignoring, sorry",
            "WARNING:root:structWarning.xml: doxygen is unable to cross-link friend class FriendClassWarning, ignoring, sorry"
        ])

class SignalsSlots(IntegrationTestCase):
    def test(self):
        self.run_doxygen(wildcard='classClass.xml')
        self.assertEqual(*self.actual_expected_contents('classClass.html'))

class VariableTemplate(IntegrationTestCase):
    def test(self):
        self.run_doxygen(wildcard='*.xml')
        self.assertEqual(*self.actual_expected_contents('structFoo.html'))
        self.assertEqual(*self.actual_expected_contents('structBar.html'))

class FunctionAttributes(IntegrationTestCase):
    def test(self):
        self.run_doxygen(wildcard='*.xml')
        self.assertEqual(*self.actual_expected_contents('structFoo.html'))
        self.assertEqual(*self.actual_expected_contents('classBase.html'))
        self.assertEqual(*self.actual_expected_contents('classDerived.html'))
        self.assertEqual(*self.actual_expected_contents('structFinal.html'))

class FunctionAttributesNospace(IntegrationTestCase):
    def test(self):
        self.run_doxygen(wildcard='structFoo.xml')
        self.assertEqual(*self.actual_expected_contents('structFoo.html'))

class MishandledMacroCall(IntegrationTestCase):
    def test(self):
        with self.assertLogs() as cm:
            self.run_doxygen(wildcard='*.xml')
        self.assertEqual(*self.actual_expected_contents('File_8h.html'))
        self.assertEqual(cm.output, [
            "WARNING:root:File_8h.xml: parameter $ of function DEFINE_FUNCTION has no type, ignoring the whole function as it's suspected to be a mishandled macro call"
        ])