|
8 | 8 |
|
9 | 9 | class TestSwiftFormatSwiftTypesInCxx(TestBase):
|
10 | 10 |
|
11 |
| - @swiftTest |
12 |
| - def test_class(self): |
| 11 | + def setup(self, bkpt_str): |
13 | 12 | self.build()
|
14 | 13 | self.runCmd('setting set target.experimental.swift-enable-cxx-interop true')
|
15 | 14 | _, _, _, _= lldbutil.run_to_source_breakpoint(
|
16 |
| - self, 'Set breakpoint here', lldb.SBFileSpec('main.cpp')) |
| 15 | + self, bkpt_str, lldb.SBFileSpec('main.cpp')) |
| 16 | + |
| 17 | + @swiftTest |
| 18 | + def test_class(self): |
| 19 | + self.setup('Break here for class') |
17 | 20 |
|
18 | 21 | self.expect('v swiftClass', substrs=['SwiftClass', 'field = 42',
|
19 | 22 | 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"',
|
20 | 23 | '[3] = "strings"'])
|
21 |
| - self.expect('p swiftClass', substrs=['SwiftClass', 'field = 42', |
| 24 | + self.expect('expr swiftClass', substrs=['SwiftClass', 'field = 42', |
22 | 25 | 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"',
|
23 | 26 | '[3] = "strings"'])
|
24 | 27 |
|
| 28 | + @swiftTest |
| 29 | + def test_subclass(self): |
| 30 | + self.setup('Break here for subclass') |
| 31 | + |
25 | 32 | self.expect('v swiftSublass', substrs=['SwiftSubclass', 'field = 42',
|
26 | 33 | 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"',
|
27 | 34 | '[3] = "strings"', 'extraField = "this is an extra subclass field"'])
|
28 |
| - self.expect('p swiftSublass', substrs=['SwiftSubclass', 'field = 42', |
| 35 | + self.expect('expr swiftSublass', substrs=['SwiftSubclass', 'field = 42', |
29 | 36 | 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"',
|
30 | 37 | '[3] = "strings"', 'extraField = "this is an extra subclass field"'])
|
31 | 38 |
|
| 39 | + @swiftTest |
| 40 | + def test_struct(self): |
| 41 | + self.setup('Break here for struct') |
| 42 | + |
32 | 43 | self.expect('v swiftStruct', substrs=['SwiftStruct', 'str = "Hello this is a big string"',
|
33 | 44 | 'boolean = true'])
|
34 |
| - self.expect('p swiftStruct', substrs=['SwiftStruct', 'str = "Hello this is a big string"', |
| 45 | + self.expect('expr swiftStruct', substrs=['SwiftStruct', 'str = "Hello this is a big string"', |
35 | 46 | 'boolean = true'])
|
36 | 47 |
|
37 |
| - self.expect('v wrapper', substrs=['a.GenericPair<a.SwiftClass, a.SwiftStruct>', |
| 48 | + @swiftTest |
| 49 | + def test_generic_struct(self): |
| 50 | + self.setup('Break here for generic struct') |
| 51 | + |
| 52 | + self.expect('v wrapper', substrs=['a.GenericStructPair<a.SwiftClass, a.SwiftStruct>', |
38 | 53 | 'field = 42', 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"',
|
39 | 54 | '[3] = "strings"', 'str = "Hello this is a big string"', 'boolean = true'])
|
40 |
| - self.expect('p wrapper', substrs=['a.GenericPair<a.SwiftClass, a.SwiftStruct>', |
| 55 | + self.expect('expr wrapper', substrs=['a.GenericStructPair<a.SwiftClass, a.SwiftStruct>', |
41 | 56 | 'field = 42', 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"',
|
42 | 57 | '[3] = "strings"', 'str = "Hello this is a big string"', 'boolean = true'])
|
| 58 | + |
| 59 | + |
| 60 | + @swiftTest |
| 61 | + def test_generic_enum(self): |
| 62 | + self.setup('Break here for generic enum') |
| 63 | + |
| 64 | + self.expect('v swiftEnum', substrs=['a.GenericEnum<a.SwiftClass>', 'some', |
| 65 | + 'field = 42', 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"', |
| 66 | + '[3] = "strings"']) |
| 67 | + self.expect('expr swiftEnum', substrs=['a.GenericEnum<a.SwiftClass>', 'some', |
| 68 | + 'field = 42', 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"', |
| 69 | + '[3] = "strings"']) |
| 70 | + |
| 71 | + |
| 72 | + @swiftTest |
| 73 | + def test_swift_ivars(self): |
| 74 | + self.setup('Break here for swift ivars') |
| 75 | + |
| 76 | + self.expect('v type_with_ivars', substrs=['TypeWithSwiftIvars', 'swiftClass', |
| 77 | + 'field = 42', 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"', |
| 78 | + '[3] = "strings"', 'swiftSubclass', 'field = 42', 'arr = 4 values', |
| 79 | + '[0] = "An"', '[1] = "array"', '[2] = "of"', '[3] = "strings"', |
| 80 | + 'extraField = "this is an extra subclass field"', |
| 81 | + 'str = "Hello this is a big string"', 'boolean = true']) |
| 82 | + self.expect('expr type_with_ivars', substrs=['TypeWithSwiftIvars', 'swiftClass', |
| 83 | + 'field = 42', 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"', |
| 84 | + '[3] = "strings"', 'swiftSubclass', 'field = 42', 'arr = 4 values', |
| 85 | + '[0] = "An"', '[1] = "array"', '[2] = "of"', '[3] = "strings"', |
| 86 | + 'extraField = "this is an extra subclass field"', |
| 87 | + 'str = "Hello this is a big string"', 'boolean = true']) |
| 88 | + |
| 89 | + @swiftTest |
| 90 | + def test_typealias(self): |
| 91 | + self.setup('Break here for swift alias') |
| 92 | + |
| 93 | + self.expect('v aliased', substrs=['SwiftClass', 'field = 42', |
| 94 | + 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"', |
| 95 | + '[3] = "strings"']) |
| 96 | + self.expect('expr aliased', substrs=['SwiftClass', 'field = 42', |
| 97 | + 'arr = 4 values', '[0] = "An"', '[1] = "array"', '[2] = "of"', |
| 98 | + '[3] = "strings"']) |
0 commit comments