Skip to content

[Cherry-pick into next] [lldb] Convert inline test to a python test (NFC) #10588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# ------------------------------------------------------------------------------
import lldbsuite.test.lldbinline as lldbinline
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil

class TestSwiftErrorType(TestBase):
@swiftTest
def test(self):
"""Test handling of Swift Error types"""
self.build()
lldbutil.run_to_source_breakpoint(
self, 'break here', lldb.SBFileSpec('main.swift'))
self.expect('frame variable -d run -- s', substrs=['SError','payload = 1'])
self.expect('frame variable -d run -- c', substrs=['CError','payload = 2'])
self.expect('frame variable -d run -- e', substrs=['EError','OutOfCookies'])
self.expect('expr -d run -- s', substrs=['SError','payload = 1'])
self.expect('expr -d run -- c', substrs=['CError','payload = 2'])
self.expect('expr -d run -- e', substrs=['EError','OutOfCookies'])

lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest])
8 changes: 1 addition & 7 deletions lldb/test/API/lang/swift/variables/error_type/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ func main() {
var c: Error = CError()
var e: Error = EError.OutOfCookies

print("break here") //% self.expect('frame variable -d run -- s', substrs=['SError','payload = 1'])
print("break here") //% self.expect('frame variable -d run -- c', substrs=['CError','payload = 2'])
print("break here") //% self.expect('frame variable -d run -- e', substrs=['EError','OutOfCookies'])

print("break here") //% self.expect('expr -d run -- s', substrs=['SError','payload = 1'])
print("break here") //% self.expect('expr -d run -- c', substrs=['CError','payload = 2'])
print("break here") //% self.expect('expr -d run -- e', substrs=['EError','OutOfCookies'])
print("break here")
}

main()