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

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

Issue 2350633003: Add Dart_GetStickyError (Closed)
Patch Set: turnidge review Created 4 years, 3 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
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 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3630 3630
3631 3631
3632 TEST_CASE(SetStickyError) { 3632 TEST_CASE(SetStickyError) {
3633 const char* kScriptChars = 3633 const char* kScriptChars =
3634 "main() => throw 'HI';"; 3634 "main() => throw 'HI';";
3635 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 3635 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
3636 Dart_Handle retobj = Dart_Invoke(lib, NewString("main"), 0, NULL); 3636 Dart_Handle retobj = Dart_Invoke(lib, NewString("main"), 0, NULL);
3637 EXPECT(Dart_IsError(retobj)); 3637 EXPECT(Dart_IsError(retobj));
3638 EXPECT(Dart_IsUnhandledExceptionError(retobj)); 3638 EXPECT(Dart_IsUnhandledExceptionError(retobj));
3639 EXPECT(!Dart_HasStickyError()); 3639 EXPECT(!Dart_HasStickyError());
3640 EXPECT(Dart_GetStickyError() == Dart_Null());
3640 Dart_SetStickyError(retobj); 3641 Dart_SetStickyError(retobj);
3641 EXPECT(Dart_HasStickyError()); 3642 EXPECT(Dart_HasStickyError());
3643 EXPECT(Dart_GetStickyError() != Dart_Null());
3644 Dart_SetStickyError(Dart_Null());
3645 EXPECT(!Dart_HasStickyError());
3646 EXPECT(Dart_GetStickyError() == Dart_Null());
3642 } 3647 }
3643 3648
3644 3649
3645 TEST_CASE(TypeGetNonParamtericTypes) { 3650 TEST_CASE(TypeGetNonParamtericTypes) {
3646 const char* kScriptChars = 3651 const char* kScriptChars =
3647 "class MyClass0 {\n" 3652 "class MyClass0 {\n"
3648 "}\n" 3653 "}\n"
3649 "\n" 3654 "\n"
3650 "class MyClass1 implements MyInterface1 {\n" 3655 "class MyClass1 implements MyInterface1 {\n"
3651 "}\n" 3656 "}\n"
(...skipping 6559 matching lines...) Expand 10 before | Expand all | Expand 10 after
10211 result = Dart_Invoke(lib, 10216 result = Dart_Invoke(lib,
10212 NewString("foozoo"), 10217 NewString("foozoo"),
10213 0, 10218 0,
10214 NULL); 10219 NULL);
10215 EXPECT(Dart_IsError(result)); 10220 EXPECT(Dart_IsError(result));
10216 } 10221 }
10217 10222
10218 #endif // !PRODUCT 10223 #endif // !PRODUCT
10219 10224
10220 } // namespace dart 10225 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698