mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
test/Interop/SwiftToCxx/functions/swift-functions-errors.swift
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
// RUN: %target-swift-frontend %S/swift-functions-errors.swift -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
|
||||
// RUN: %target-swift-frontend %S/swift-functions-errors.swift -typecheck -module-name Functions -clang-header-expose-decls=has-expose-attr -emit-clang-header-path %t/functions.h
|
||||
|
||||
// RUN: %target-interop-build-clangxx -c %s -I %t -o %t/swift-functions-errors-execution.o
|
||||
// RUN: %target-interop-build-clangxx -std=c++17 -x objective-c++ -c %s -I %t -o %t/swift-functions-errors-execution.o
|
||||
// RUN: %target-interop-build-swift %S/swift-functions-errors.swift -o %t/swift-functions-errors-execution -Xlinker %t/swift-functions-errors-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain
|
||||
|
||||
// RUN: %target-codesign %t/swift-functions-errors-execution
|
||||
@@ -27,7 +27,11 @@ int main() {
|
||||
try {
|
||||
Functions::throwFunction();
|
||||
} catch (swift::Error& e) {
|
||||
printf("Exception\n");
|
||||
auto errorVal = e.as<Functions::NaiveErrors, Functions::_impl::_impl_NaiveErrors>();
|
||||
if (errorVal) {
|
||||
assert(errorVal == Functions::NaiveErrors::throwError);
|
||||
errorVal->getMessage();
|
||||
}
|
||||
}
|
||||
try {
|
||||
Functions::throwFunctionWithReturn();
|
||||
@@ -43,7 +47,7 @@ int main() {
|
||||
|
||||
// CHECK: passEmptyThrowFunction
|
||||
// CHECK-NEXT: passThrowFunction
|
||||
// CHECK-NEXT: Exception
|
||||
// CHECK-NEXT: throwError
|
||||
// CHECK-NEXT: passThrowFunctionWithReturn
|
||||
// CHECK-NEXT: Exception
|
||||
// CHECK-NEXT: Test destroyed
|
||||
Reference in New Issue
Block a user