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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 2223913002: Add an API for setting the sticky error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: asiva review Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_mirrors_api.h" 8 #include "include/dart_mirrors_api.h"
9 #include "include/dart_native_api.h" 9 #include "include/dart_native_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 3600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 3611
3612 UNIT_TEST_CASE(SetMessageCallbacks) { 3612 UNIT_TEST_CASE(SetMessageCallbacks) {
3613 Dart_Isolate dart_isolate = TestCase::CreateTestIsolate(); 3613 Dart_Isolate dart_isolate = TestCase::CreateTestIsolate();
3614 Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback); 3614 Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback);
3615 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); 3615 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
3616 EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback()); 3616 EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback());
3617 Dart_ShutdownIsolate(); 3617 Dart_ShutdownIsolate();
3618 } 3618 }
3619 3619
3620 3620
3621 TEST_CASE(SetStickyError) {
3622 const char* kScriptChars =
3623 "main() => throw 'HI';";
3624 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
3625 Dart_Handle retobj = Dart_Invoke(lib, NewString("main"), 0, NULL);
3626 EXPECT(Dart_IsError(retobj));
3627 EXPECT(Dart_IsUnhandledExceptionError(retobj));
3628 EXPECT(!Dart_HasStickyError());
3629 Dart_SetStickyError(retobj);
3630 EXPECT(Dart_HasStickyError());
3631 }
3632
3633
3621 TEST_CASE(TypeGetNonParamtericTypes) { 3634 TEST_CASE(TypeGetNonParamtericTypes) {
3622 const char* kScriptChars = 3635 const char* kScriptChars =
3623 "class MyClass0 {\n" 3636 "class MyClass0 {\n"
3624 "}\n" 3637 "}\n"
3625 "\n" 3638 "\n"
3626 "class MyClass1 implements MyInterface1 {\n" 3639 "class MyClass1 implements MyInterface1 {\n"
3627 "}\n" 3640 "}\n"
3628 "\n" 3641 "\n"
3629 "class MyClass2 implements MyInterface0, MyInterface1 {\n" 3642 "class MyClass2 implements MyInterface0, MyInterface1 {\n"
3630 "}\n" 3643 "}\n"
(...skipping 6556 matching lines...) Expand 10 before | Expand all | Expand 10 after
10187 result = Dart_Invoke(lib, 10200 result = Dart_Invoke(lib,
10188 NewString("foozoo"), 10201 NewString("foozoo"),
10189 0, 10202 0,
10190 NULL); 10203 NULL);
10191 EXPECT(Dart_IsError(result)); 10204 EXPECT(Dart_IsError(result));
10192 } 10205 }
10193 10206
10194 #endif // !PRODUCT 10207 #endif // !PRODUCT
10195 10208
10196 } // namespace dart 10209 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698