Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 1190413006: Fix line width issue. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address code review comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..896e14e2bb976716cac3853d9b0fc4e861df72eb 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -448,6 +448,59 @@ TEST_CASE(ErrorHandleTypes) {
}
+TEST_CASE(UnhandleExceptionError) {
+ Isolate* isolate = Isolate::Current();
+ const char* exception_cstr = "";
+
+ // Test with an API Error.
+ const char* kApiError = "Api Error Exception Test.";
+ Dart_Handle api_error = Api::NewHandle(
+ isolate,
+ ApiError::New(String::Handle(String::New(kApiError))));
+ Dart_Handle exception_error = Dart_NewUnhandledExceptionError(api_error);
+ EXPECT(!Dart_IsApiError(exception_error));
+ EXPECT(Dart_IsUnhandledExceptionError(exception_error));
+ EXPECT(Dart_IsString(Dart_ErrorGetException(exception_error)));
+ EXPECT_VALID(Dart_StringToCString(Dart_ErrorGetException(exception_error),
+ &exception_cstr));
+ EXPECT_STREQ(kApiError, exception_cstr);
+
+ // Test with a Compilation Error.
+ const char* kCompileError = "CompileError Exception Test.";
+ const String& compile_message =
+ String::Handle(String::New(kCompileError));
+ 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));
+ EXPECT(Dart_IsString(Dart_ErrorGetException(exception_error)));
+ EXPECT_VALID(Dart_StringToCString(Dart_ErrorGetException(exception_error),
+ &exception_cstr));
+ EXPECT_STREQ(kCompileError, exception_cstr);
+
+ // 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.
+ const char* kRegularString = "Regular String Exception Test.";
+ Dart_Handle obj = Api::NewHandle(isolate, String::New(kRegularString));
+ exception_error = Dart_NewUnhandledExceptionError(obj);
+ EXPECT(!Dart_IsApiError(exception_error));
+ EXPECT(Dart_IsUnhandledExceptionError(exception_error));
+ EXPECT(Dart_IsString(Dart_ErrorGetException(exception_error)));
+ EXPECT_VALID(Dart_StringToCString(Dart_ErrorGetException(exception_error),
+ &exception_cstr));
+ EXPECT_STREQ(kRegularString, exception_cstr);
+}
+
+
void PropagateErrorNative(Dart_NativeArguments args) {
Dart_EnterScope();
Dart_Handle closure = Dart_GetNativeArgument(args, 0);
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698