Skip to content

Commit 24976d5

Browse files
Merge pull request #10564 from adrian-prantl/inline-error
[lldb] Convert inline test to a python test (NFC)
2 parents ca46e07 + e186f01 commit 24976d5

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

lldb/test/API/lang/swift/variables/error_type/TestSwiftErrorType.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,22 @@
99
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
#
1111
# ------------------------------------------------------------------------------
12-
import lldbsuite.test.lldbinline as lldbinline
12+
import lldb
13+
from lldbsuite.test.lldbtest import *
1314
from lldbsuite.test.decorators import *
15+
import lldbsuite.test.lldbutil as lldbutil
16+
17+
class TestSwiftErrorType(TestBase):
18+
@swiftTest
19+
def test(self):
20+
"""Test handling of Swift Error types"""
21+
self.build()
22+
lldbutil.run_to_source_breakpoint(
23+
self, 'break here', lldb.SBFileSpec('main.swift'))
24+
self.expect('frame variable -d run -- s', substrs=['SError','payload = 1'])
25+
self.expect('frame variable -d run -- c', substrs=['CError','payload = 2'])
26+
self.expect('frame variable -d run -- e', substrs=['EError','OutOfCookies'])
27+
self.expect('expr -d run -- s', substrs=['SError','payload = 1'])
28+
self.expect('expr -d run -- c', substrs=['CError','payload = 2'])
29+
self.expect('expr -d run -- e', substrs=['EError','OutOfCookies'])
1430

15-
lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest])

lldb/test/API/lang/swift/variables/error_type/main.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,7 @@ func main() {
4242
var c: Error = CError()
4343
var e: Error = EError.OutOfCookies
4444

45-
print("break here") //% self.expect('frame variable -d run -- s', substrs=['SError','payload = 1'])
46-
print("break here") //% self.expect('frame variable -d run -- c', substrs=['CError','payload = 2'])
47-
print("break here") //% self.expect('frame variable -d run -- e', substrs=['EError','OutOfCookies'])
48-
49-
print("break here") //% self.expect('expr -d run -- s', substrs=['SError','payload = 1'])
50-
print("break here") //% self.expect('expr -d run -- c', substrs=['CError','payload = 2'])
51-
print("break here") //% self.expect('expr -d run -- e', substrs=['EError','OutOfCookies'])
45+
print("break here")
5246
}
5347

5448
main()

0 commit comments

Comments
 (0)