File: TestSwiftBackwardInteropStepping.py

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (158 lines) | stat: -rw-r--r-- 5,748 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158

"""
Test that Swift types are displayed correctly in C++
"""
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *


class TestSwiftBackwardInteropStepping(TestBase):

    def setup(self, bkpt_str):
        self.build()
        
        _, _, thread, _ = lldbutil.run_to_source_breakpoint(
            self, bkpt_str, lldb.SBFileSpec('main.cpp'))
        return thread


    def check_step_in(self, thread, caller, callee):
        name = thread.frames[0].GetFunctionName()
        self.assertIn(caller, name)
        thread.StepInto()
        name = thread.frames[0].GetFunctionName()
        self.assertIn(callee, name)
        thread.StepOut()
        name = thread.frames[0].GetFunctionName()
        self.assertIn(caller, name)

    def check_step_over(self, thread, func):
        name = thread.frames[0].GetFunctionName()
        self.assertIn(func, name)
        thread.StepOver()
        name = thread.frames[0].GetFunctionName()
        self.assertIn(func, name)

    @swiftTest
    def test_func_step_in(self):
        thread = self.setup('Break here for func')
        self.check_step_in(thread, 'testFunc', 'swiftFunc')
        
    @swiftTest
    def test_func_step_over(self):
        thread = self.setup('Break here for func')
        self.check_step_over(thread, 'testFunc')

    @swiftTest
    def test_method_step_in_class(self):
        thread = self.setup('Break here for method - class')
        self.check_step_in(thread, 'testMethod', 'SwiftClass.swiftMethod')
        
    @swiftTest
    def test_method_step_over_class(self):
        thread = self.setup('Break here for method - class')
        self.check_step_over(thread, 'testMethod')

    @expectedFailureAll(bugnumber="rdar://106670255")
    @swiftTest
    def test_init_step_in_class(self):
        thread = self.setup('Break here for constructor - class')
        self.check_step_in(thread, 'testConstructor', 'SwiftClass.init')
        
    @swiftTest
    def test_init_step_over_class(self):
        thread = self.setup('Break here for constructor - class')
        self.check_step_over(thread, 'testConstructor')

    @swiftTest
    def test_static_method_step_in_class(self):
        thread = self.setup('Break here for static method - class')
        self.check_step_in(thread, 'testStaticMethod', 'SwiftClass.swiftStaticMethod')
        
    @swiftTest
    def test_static_method_step_over_class(self):
        thread = self.setup('Break here for static method - class')
        self.check_step_over(thread, 'testStaticMethod')

    @swiftTest
    def test_getter_step_in_class(self):
        thread = self.setup('Break here for getter - class')
        self.check_step_in(thread, 'testGetter', 'SwiftClass.swiftProperty.getter')
        
    @swiftTest
    def test_getter_step_over_class(self):
        thread = self.setup('Break here for getter - class')
        self.check_step_over(thread, 'testGetter')

    @swiftTest
    def test_setter_step_in_class(self):
        thread = self.setup('Break here for setter - class')
        self.check_step_in(thread, 'testSetter', 'SwiftClass.swiftProperty.setter')
        
    @swiftTest
    def test_setter_step_over_class(self):
        thread = self.setup('Break here for setter - class')
        self.check_step_over(thread, 'testSetter')


    @swiftTest
    def test_overriden_step_in_class(self):
        thread = self.setup('Break here for overridden - class')
        self.check_step_in(thread, 'testOverridenMethod', 'SwiftSubclass.overrideableMethod')
        
    @swiftTest
    def test_overriden_step_over_class(self):
        thread = self.setup('Break here for overridden')
        self.check_step_over(thread, 'testOverridenMethod')

    @swiftTest
    def test_method_step_in_struct_class(self):
        thread = self.setup('Break here for method - struct')
        self.check_step_in(thread, 'testMethod', 'SwiftStruct.swiftMethod')
        
    @swiftTest
    def test_method_step_over_struct_class(self):
        thread = self.setup('Break here for method - struct')
        self.check_step_over(thread, 'testMethod')

    @expectedFailureAll(bugnumber="rdar://106670255")
    @swiftTest
    def test_init_step_in_struct_class(self):
        thread = self.setup('Break here for constructor - struct')
        self.check_step_in(thread, 'testConstructor', 'SwiftStruct.init')
        
    @swiftTest
    def test_init_step_over_struct_class(self):
        thread = self.setup('Break here for constructor - struct')
        self.check_step_over(thread, 'testConstructor')

    @swiftTest
    def test_static_method_step_in_struct(self):
        thread = self.setup('Break here for static method - struct')
        self.check_step_in(thread, 'testStaticMethod', 'SwiftStruct.swiftStaticMethod')
        
    @swiftTest
    def test_static_method_step_over_struct(self):
        thread = self.setup('Break here for static method - struct')
        self.check_step_over(thread, 'testStaticMethod')

    @swiftTest
    def test_getter_step_in_struct(self):
        thread = self.setup('Break here for getter - struct')
        self.check_step_in(thread, 'testGetter', 'SwiftStruct.swiftProperty.getter')
        
    @swiftTest
    def test_getter_step_over_struct(self):
        thread = self.setup('Break here for getter - struct')
        self.check_step_over(thread, 'testGetter')

    @swiftTest
    def test_setter_step_in_struct(self):
        thread = self.setup('Break here for setter - struct')
        self.check_step_in(thread, 'testSetter', 'SwiftStruct.swiftProperty.setter')
        
    @swiftTest
    def test_setter_step_over_struct(self):
        thread = self.setup('Break here for setter - struct')
        self.check_step_over(thread, 'testSetter')