Chromium Code Reviews| Index: runtime/vm/dart_api_impl_test.cc |
| diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc |
| index a3a436b8d57f3ad364d85c6d9afa6161097f4973..0b6679e7d35423b212a5a0febdce8e4a651adb0c 100644 |
| --- a/runtime/vm/dart_api_impl_test.cc |
| +++ b/runtime/vm/dart_api_impl_test.cc |
| @@ -448,6 +448,45 @@ TEST_CASE(ErrorHandleTypes) { |
| } |
| +TEST_CASE(UnhandleExceptionError) { |
| + Isolate* isolate = Isolate::Current(); |
| + |
| + // Test with an API Error. |
| + Dart_Handle api_error = Api::NewHandle( |
| + isolate, |
| + ApiError::New(String::Handle(String::New("Api Error Exception Test.")))); |
| + Dart_Handle exception_error = Dart_NewUnhandledExceptionError(api_error); |
| + EXPECT(!Dart_IsApiError(exception_error)); |
| + EXPECT(Dart_IsUnhandledExceptionError(exception_error)); |
| + |
|
rmacnak
2015/06/19 23:26:10
EXPECT(Dart_IsString(Dart_ErrorGetException(except
siva
2015/06/19 23:43:44
Done.
|
| + // Test with a Compilation Error. |
| + const String& compile_message = |
| + String::Handle(String::New("CompileError Exception Test.")); |
| + Dart_Handle compile_error = |
| + Api::NewHandle(isolate, LanguageError::New(compile_message)); |
| + exception_error = Dart_NewUnhandledExceptionError(compile_error); |
| + EXPECT(!Dart_IsApiError(exception_error)); |
| + EXPECT(Dart_IsUnhandledExceptionError(exception_error)); |
| + |
|
rmacnak
2015/06/19 23:26:10
Ditto
siva
2015/06/19 23:43:44
Done.
|
| + // Test with a Fatal Error. |
| + const String& fatal_message = |
| + String::Handle(String::New("FatalError Exception Test.")); |
| + Dart_Handle fatal_error = |
| + Api::NewHandle(isolate, UnwindError::New(fatal_message)); |
| + exception_error = Dart_NewUnhandledExceptionError(fatal_error); |
| + EXPECT(Dart_IsError(exception_error)); |
| + EXPECT(!Dart_IsUnhandledExceptionError(exception_error)); |
| + |
| + // Test with a Regular object. |
| + Dart_Handle obj = Api::NewHandle( |
| + isolate, |
| + String::New("Regular String Exception Test.")); |
| + exception_error = Dart_NewUnhandledExceptionError(obj); |
| + EXPECT(!Dart_IsApiError(exception_error)); |
| + EXPECT(Dart_IsUnhandledExceptionError(exception_error)); |
|
rmacnak
2015/06/19 23:26:10
Ditto
siva
2015/06/19 23:43:44
Done.
|
| +} |
| + |
| + |
| void PropagateErrorNative(Dart_NativeArguments args) { |
| Dart_EnterScope(); |
| Dart_Handle closure = Dart_GetNativeArgument(args, 0); |