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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 8501034: Deal with unhandled exceptions the same way in all Dart api functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 1328)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -14,17 +14,68 @@
namespace dart {
#if defined(TARGET_ARCH_IA32)
+
+UNIT_TEST_CASE(ErrorHandles) {
+ const char* kScriptChars =
+ "class TestClass {\n"
+ " static void testMain() {\n"
+ " throw new Exception(\"bad news\");\n"
+ " }\n"
+ "}\n";
+
+ Dart_CreateIsolate(NULL, NULL);
+ Dart_EnterScope();
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+
+ Dart_Handle instance = Dart_True();
+ Dart_Handle error = Api::Error("myerror");
+ Dart_Handle exception = Dart_InvokeStatic(lib,
+ Dart_NewString("TestClass"),
+ Dart_NewString("testMain"),
+ 0,
+ NULL);
+
+ EXPECT(!Dart_IsError(instance));
+ EXPECT(Dart_IsError(error));
+ EXPECT(Dart_IsError(exception));
+
+ EXPECT(!Dart_IsUnhandledException(instance));
+ EXPECT(!Dart_IsUnhandledException(error));
+ EXPECT(Dart_IsUnhandledException(exception));
+
+ EXPECT_STREQ("", Dart_GetError(instance));
+ EXPECT_STREQ("myerror", Dart_GetError(error));
+ EXPECT_STREQ(
+ "Unhandled exception:\n"
+ "Exception: bad news\n"
+ " 0. Function: 'TestClass.testMain' url: 'dart:test-lib' line:3 col:5\n",
Anton Muhin 2011/11/09 12:34:03 do you want to mandate this exactly output?
turnidge 2011/11/09 19:53:41 For now, yes. I want to nail down exactly what th
+ Dart_GetError(exception));
+
+ EXPECT(Dart_IsError(Dart_GetException(instance)));
+ EXPECT(Dart_IsError(Dart_GetException(error)));
+ EXPECT_VALID(Dart_GetException(exception));
+
+ EXPECT(Dart_IsError(Dart_GetStacktrace(instance)));
+ EXPECT(Dart_IsError(Dart_GetStacktrace(error)));
+ EXPECT_VALID(Dart_GetStacktrace(exception));
+
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+}
+
+
UNIT_TEST_CASE(Dart_Error) {
Dart_CreateIsolate(NULL, NULL);
Dart_EnterScope();
Dart_Handle error = Dart_Error("An %s", "error");
- EXPECT(!Dart_IsValid(error));
+ EXPECT(Dart_IsError(error));
EXPECT_STREQ("An error", Dart_GetError(error));
Dart_ExitScope();
Dart_ShutdownIsolate();
}
+
#endif
@@ -125,7 +176,7 @@
bool value = false;
Dart_Handle result = Dart_BooleanValue(str, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
Dart_Handle val1 = Dart_NewBoolean(true);
EXPECT(Dart_IsBoolean(val1));
@@ -223,7 +274,6 @@
0,
NULL);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(Dart_IsNumber(result));
// Check double case.
@@ -233,7 +283,6 @@
0,
NULL);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(Dart_IsNumber(result));
// Check bool case.
@@ -243,7 +292,6 @@
0,
NULL);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(!Dart_IsNumber(result));
// Check null case.
@@ -253,7 +301,6 @@
0,
NULL);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(!Dart_IsNumber(result));
Dart_ExitScope(); // Exit the Dart API scope.
@@ -326,13 +373,13 @@
// Check invalid array access.
result = Dart_ListSetAt(val, (kArrayLength + 10), Dart_NewInteger(10));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_ListSetAt(val, -10, Dart_NewInteger(10));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_ListGetAt(val, (kArrayLength + 10));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_ListGetAt(val, -10);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
for (int i = 0; i < kArrayLength; i++) {
result = Dart_ListSetAt(val, i, Dart_NewInteger(i));
@@ -381,8 +428,7 @@
Dart_NewString("testMain"),
0,
NULL);
- EXPECT(Dart_IsValid(result));
- EXPECT(!Dart_ExceptionOccurred(result));
+ EXPECT_VALID(result);
// First ensure that the returned object is an array.
Dart_Handle ListAccessTestObj = result;
@@ -392,65 +438,65 @@
// Get length of array object.
intptr_t len = 0;
result = Dart_ListLength(ListAccessTestObj, &len);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(3, len);
// Access elements in the array.
int64_t value;
result = Dart_ListGetAt(ListAccessTestObj, 0);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(10, value);
result = Dart_ListGetAt(ListAccessTestObj, 1);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(20, value);
result = Dart_ListGetAt(ListAccessTestObj, 2);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(30, value);
// Set some elements in the array.
result = Dart_ListSetAt(ListAccessTestObj, 0, Dart_NewInteger(0));
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_ListSetAt(ListAccessTestObj, 1, Dart_NewInteger(1));
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_ListSetAt(ListAccessTestObj, 2, Dart_NewInteger(2));
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
// Get length of array object.
result = Dart_ListLength(ListAccessTestObj, &len);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(3, len);
// Now try and access these elements in the array.
result = Dart_ListGetAt(ListAccessTestObj, 0);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(0, value);
result = Dart_ListGetAt(ListAccessTestObj, 1);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(1, value);
result = Dart_ListGetAt(ListAccessTestObj, 2);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(2, value);
uint8_t native_array[3];
result = Dart_ListGetAsBytes(ListAccessTestObj, 0, native_array, 3);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(0, native_array[0]);
EXPECT_EQ(1, native_array[1]);
EXPECT_EQ(2, native_array[2]);
@@ -459,21 +505,21 @@
native_array[1] = 20;
native_array[2] = 30;
result = Dart_ListSetAsBytes(ListAccessTestObj, 0, native_array, 3);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_ListGetAsBytes(ListAccessTestObj, 0, native_array, 3);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(10, native_array[0]);
EXPECT_EQ(20, native_array[1]);
EXPECT_EQ(30, native_array[2]);
result = Dart_ListGetAt(ListAccessTestObj, 2);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
- EXPECT(Dart_IsValid(result));
+ EXPECT_VALID(result);
EXPECT_EQ(30, value);
// Check if we get an exception when accessing beyond limit.
result = Dart_ListGetAt(ListAccessTestObj, 4);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -803,15 +849,14 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
// Now access and set various static fields of Fields class.
Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("Fields"));
EXPECT_VALID(cls);
result = Dart_GetStaticField(cls, Dart_NewString("fld1"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetInstanceField(retobj, Dart_NewString("fld3"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetStaticField(cls, Dart_NewString("fld4"));
EXPECT_VALID(result);
int64_t value = 0;
@@ -820,7 +865,7 @@
result = Dart_SetStaticField(cls,
Dart_NewString("fld4"),
Dart_NewInteger(20));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetStaticField(cls, Dart_NewString("fld3"));
EXPECT_VALID(result);
result = Dart_SetStaticField(cls,
@@ -832,7 +877,7 @@
// Now access and set various instance fields of the returned object.
result = Dart_GetInstanceField(retobj, Dart_NewString("fld3"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetInstanceField(retobj, Dart_NewString("fld1"));
EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
@@ -844,7 +889,7 @@
result = Dart_SetInstanceField(retobj,
Dart_NewString("fld2"),
Dart_NewInteger(40));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetInstanceField(retobj,
Dart_NewString("fld1"),
Dart_NewInteger(40));
@@ -891,15 +936,14 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
// Now access and set various static fields of HiddenFields class.
Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("HiddenFields"));
EXPECT_VALID(cls);
result = Dart_GetStaticField(cls, Dart_NewString("_fld1"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetInstanceField(retobj, Dart_NewString("_fld3"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetStaticField(cls, Dart_NewString("_fld4"));
EXPECT_VALID(result);
int64_t value = 0;
@@ -908,7 +952,7 @@
result = Dart_SetStaticField(cls,
Dart_NewString("_fld4"),
Dart_NewInteger(20));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetStaticField(cls, Dart_NewString("_fld3"));
EXPECT_VALID(result);
result = Dart_SetStaticField(cls,
@@ -920,7 +964,7 @@
// Now access and set various instance fields of the returned object.
result = Dart_GetInstanceField(retobj, Dart_NewString("_fld3"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetInstanceField(retobj, Dart_NewString("_fld1"));
EXPECT_VALID(result);
result = Dart_IntegerValue(result, &value);
@@ -932,7 +976,7 @@
result = Dart_SetInstanceField(retobj,
Dart_NewString("_fld2"),
Dart_NewInteger(40));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetInstanceField(retobj,
Dart_NewString("_fld1"),
Dart_NewInteger(40));
@@ -990,7 +1034,6 @@
0,
NULL);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
Instance& obj = Instance::Handle();
obj ^= Api::UnwrapHandle(result);
const Class& cls = Class::Handle(obj.clazz());
@@ -1043,7 +1086,7 @@
// We expect this to fail as class "NativeFields" extends
// "NativeFieldsWrapper" and there is no definition of it either
// in the dart code or through the native field injection mechanism.
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -1091,11 +1134,10 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
// Now access and set various instance fields of the returned object.
result = Dart_GetInstanceField(retobj, Dart_NewString("fld3"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetInstanceField(retobj, Dart_NewString("fld1"));
EXPECT_VALID(result);
int64_t value = 0;
@@ -1108,7 +1150,7 @@
result = Dart_SetInstanceField(retobj,
Dart_NewString("fld2"),
Dart_NewInteger(40));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetInstanceField(retobj,
Dart_NewString("fld1"),
Dart_NewInteger(40));
@@ -1126,7 +1168,7 @@
const int kNativeFld4 = 4;
intptr_t field_value = 0;
result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &field_value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld0, &field_value);
EXPECT_VALID(result);
EXPECT_EQ(0, field_value);
@@ -1137,7 +1179,7 @@
EXPECT_VALID(result);
EXPECT_EQ(0, field_value);
result = Dart_SetNativeInstanceField(retobj, kNativeFld4, 40);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld0, 4);
EXPECT_VALID(result);
result = Dart_SetNativeInstanceField(retobj, kNativeFld1, 40);
@@ -1203,7 +1245,6 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
// Now access and set various native instance fields of the returned object.
// All of these tests are expected to return failure as there are no
@@ -1215,19 +1256,19 @@
const int kNativeFld4 = 4;
intptr_t value = 0;
result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld0, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld1, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld2, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld4, 40);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld3, 40);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld0, 400);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
// Invoke a function which returns a closure object.
retobj = Dart_InvokeStatic(lib,
@@ -1236,21 +1277,20 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld0, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld1, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_GetNativeInstanceField(retobj, kNativeFld2, &value);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld4, 40);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld3, 40);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_SetNativeInstanceField(retobj, kNativeFld0, 400);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -1341,14 +1381,14 @@
EXPECT_VALID(cls);
result = Dart_GetStaticField(cls, Dart_NewString("not_found"));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
EXPECT_STREQ("Specified field is not found in the class",
Dart_GetError(result));
result = Dart_SetStaticField(cls,
Dart_NewString("not_found"),
Dart_NewInteger(13));
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
EXPECT_STREQ("Specified field is not found in the class",
Dart_GetError(result));
@@ -1392,7 +1432,6 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
// Now invoke a dynamic method and check the result.
@@ -1403,17 +1442,16 @@
1,
dart_arguments);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
result = Dart_IntegerValue(result, &value);
EXPECT_EQ(41, value);
result = Dart_InvokeDynamic(retobj, Dart_NewString("method2"), 0, NULL);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
result = Dart_InvokeDynamic(retobj, Dart_NewString("method1"), 0, NULL);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -1464,7 +1502,6 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
EXPECT(Dart_IsClosure(retobj));
EXPECT(!Dart_IsClosure(Dart_NewInteger(101)));
@@ -1474,7 +1511,6 @@
dart_arguments[0] = Dart_NewInteger(1);
result = Dart_InvokeClosure(retobj, 1, dart_arguments);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
result = Dart_IntegerValue(result, &value);
@@ -1482,8 +1518,8 @@
// Invoke closure with wrong number of args, should result in exception.
result = Dart_InvokeClosure(retobj, 0, NULL);
- EXPECT_VALID(result);
- EXPECT(Dart_ExceptionOccurred(result));
+ EXPECT(Dart_IsError(result));
+ EXPECT(Dart_IsUnhandledException(result));
// Invoke a function which returns a closure.
retobj = Dart_InvokeStatic(lib,
@@ -1492,7 +1528,6 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
EXPECT(Dart_IsClosure(retobj));
EXPECT(!Dart_IsClosure(Dart_NewString("abcdef")));
@@ -1500,7 +1535,8 @@
// Now invoke the closure and check the result (should be an exception).
dart_arguments[0] = Dart_NewInteger(1);
result = Dart_InvokeClosure(retobj, 1, dart_arguments);
- EXPECT(Dart_ExceptionOccurred(result));
+ EXPECT(Dart_IsError(result));
+ EXPECT(Dart_IsUnhandledException(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -1562,18 +1598,16 @@
0,
NULL);
EXPECT_VALID(retobj);
- EXPECT(!Dart_ExceptionOccurred(retobj));
// Throwing an exception here should result in an error.
result = Dart_ThrowException(retobj);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
// Now invoke method2 which invokes a natve method where it is
// ok to throw an exception, check the result which would indicate
// if an exception was thrown or not.
result = Dart_InvokeDynamic(retobj, Dart_NewString("method2"), 0, NULL);
EXPECT_VALID(result);
- EXPECT(!Dart_ExceptionOccurred(result));
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
result = Dart_IntegerValue(result, &value);
@@ -1652,7 +1686,7 @@
// Lookup a class that does not exist.
cls = Dart_GetClass(lib, Dart_NewString("DoesNotExist"));
- EXPECT(!Dart_IsValid(cls));
+ EXPECT(Dart_IsError(cls));
EXPECT_STREQ("Class 'DoesNotExist' not found in library 'dart:test-lib'.",
Dart_GetError(cls));
@@ -1689,12 +1723,10 @@
0,
NULL);
EXPECT_VALID(instanceOfTestObj);
- EXPECT(!Dart_ExceptionOccurred(instanceOfTestObj));
// Fetch InstanceOfTest class.
Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("InstanceOfTest"));
EXPECT_VALID(cls);
- EXPECT(!Dart_ExceptionOccurred(cls));
// Now check instanceOfTestObj reported as an instance of
// InstanceOfTest class.
@@ -1706,7 +1738,6 @@
// Fetch OtherClass and check if instanceOfTestObj is instance of it.
Dart_Handle otherClass = Dart_GetClass(lib, Dart_NewString("OtherClass"));
EXPECT_VALID(otherClass);
- EXPECT(!Dart_ExceptionOccurred(otherClass));
result = Dart_ObjectIsType(instanceOfTestObj, otherClass, &is_instance);
EXPECT_VALID(result);
@@ -1733,7 +1764,6 @@
0,
NULL);
EXPECT_VALID(null);
- EXPECT(!Dart_ExceptionOccurred(null));
result = Dart_ObjectIsType(null, otherClass, &is_instance);
EXPECT_VALID(result);
@@ -1741,7 +1771,7 @@
// Check that error is returned if null is passed as a class argument.
result = Dart_ObjectIsType(null, null, &is_instance);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
Dart_ExitScope(); // Exit the Dart API scope.
}
@@ -1773,8 +1803,8 @@
function_name2,
number_of_arguments,
dart_arguments);
- EXPECT_VALID(result);
- EXPECT(Dart_ExceptionOccurred(result)); */
+ EXPECT(Dart_IsError(result));
+ EXPECT(Dart_IsUnhandledException(result)); */
}
Dart_ExitScope(); // Exit the Dart API scope.
Dart_ShutdownIsolate();
@@ -1828,7 +1858,7 @@
Dart_NewString("main"),
0,
NULL);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
EXPECT_STREQ("Duplicate definition : 'foo' is defined in"
" 'library2.dart' and 'dart:test-lib'\n",
Dart_GetError(result));
@@ -1920,7 +1950,7 @@
Dart_NewString("main"),
0,
NULL);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
EXPECT_STREQ("Duplicate definition : 'foo' is defined in"
" 'library1.dart' and 'library2.dart'\n",
Dart_GetError(result));
@@ -2002,7 +2032,7 @@
Dart_NewString("main"),
0,
NULL);
- EXPECT(!Dart_IsValid(result));
+ EXPECT(Dart_IsError(result));
EXPECT_STREQ("Duplicate definition : 'fooC' is defined in"
" 'libraryF.dart' and 'libraryC.dart'\n",
Dart_GetError(result));

Powered by Google App Engine
This is Rietveld 408576698