mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SwiftToCxx] Creating new test case and fixing namespace
This commit is contained in:
@@ -25,7 +25,27 @@ public func emptyThrowFunction() throws { print("passEmptyThrowFunction") }
|
||||
// CHECK: void* self = nullptr;
|
||||
// CHECK: _impl::$s9Functions18emptyThrowFunctionyyKF(self, &opaqueError);
|
||||
// CHECK: if (opaqueError != nullptr)
|
||||
// CHECK: throw (swift::_impl::swift::Error(opaqueError))
|
||||
// CHECK: throw (swift::Error(opaqueError))
|
||||
// CHECK: }
|
||||
|
||||
class TestDestroyed {
|
||||
deinit {
|
||||
print("Test destroyed")
|
||||
}
|
||||
}
|
||||
|
||||
public struct DestroyedError : Error {
|
||||
let t = TestDestroyed()
|
||||
}
|
||||
|
||||
public func testDestroyedError() throws { throw DestroyedError() }
|
||||
|
||||
// CHECK: inline void testDestroyedError() {
|
||||
// CHECK: void* opaqueError = nullptr;
|
||||
// CHECK: void* self = nullptr;
|
||||
// CHECK: _impl::$s9Functions18testDestroyedErroryyKF(self, &opaqueError);
|
||||
// CHECK: if (opaqueError != nullptr)
|
||||
// CHECK: throw (swift::Error(opaqueError))
|
||||
// CHECK: }
|
||||
|
||||
public func throwFunction() throws {
|
||||
@@ -38,7 +58,7 @@ public func throwFunction() throws {
|
||||
// CHECK: void* self = nullptr;
|
||||
// CHECK: _impl::$s9Functions13throwFunctionyyKF(self, &opaqueError);
|
||||
// CHECK: if (opaqueError != nullptr)
|
||||
// CHECK: throw (swift::_impl::swift::Error(opaqueError))
|
||||
// CHECK: throw (swift::Error(opaqueError))
|
||||
// CHECK: }
|
||||
|
||||
public func throwFunctionWithReturn() throws -> Int {
|
||||
@@ -52,6 +72,6 @@ public func throwFunctionWithReturn() throws -> Int {
|
||||
// CHECK: void* self = nullptr;
|
||||
// CHECK: auto returnValue = _impl::$s9Functions23throwFunctionWithReturnSiyKF(self, &opaqueError);
|
||||
// CHECK: if (opaqueError != nullptr)
|
||||
// CHECK: throw (swift::_impl::swift::Error(opaqueError))
|
||||
// CHECK: throw (swift::Error(opaqueError))
|
||||
// CHECK: return returnValue;
|
||||
// CHECK: }
|
||||
Reference in New Issue
Block a user