[SwiftToCxx] Creating new test case and fixing namespace

This commit is contained in:
Roberto Rosmaninho
2022-09-05 10:38:28 -03:00
parent 9ebc0bd26e
commit 68bfbddf14
4 changed files with 37 additions and 15 deletions

View File

@@ -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: }