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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 1406573003: Fix for issue 22379246 makes the API consistent between Dart_New and Dart_InvokeConstructor. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years, 2 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 6a53ff76355796dbadc920839f8db743a7cacd11..79cbf8760f5ded44c0ce173349c21c489faa2c9e 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -4253,7 +4253,7 @@ TEST_CASE(FieldAccess) {
Dart_Handle url = NewString("library_url");
Dart_Handle source = NewString(kImportedScriptChars);
Dart_Handle imported_lib = Dart_LoadLibrary(url, source, 0, 0);
- Dart_Handle prefix = NewString("");
+ Dart_Handle prefix = Dart_EmptyString();
EXPECT_VALID(imported_lib);
Dart_Handle result = Dart_LibraryImportLibrary(lib, imported_lib, prefix);
EXPECT_VALID(result);
@@ -5126,7 +5126,7 @@ TEST_CASE(New) {
Dart_Handle bad_args[1];
bad_args[0] = Dart_NewApiError("myerror");
- // Invoke the unnamed constructor.
+ // Allocate and Invoke the unnamed constructor passing in Dart_Null.
Dart_Handle result = Dart_New(type, Dart_Null(), 0, NULL);
EXPECT_VALID(result);
bool instanceof = false;
@@ -5146,8 +5146,8 @@ TEST_CASE(New) {
foo = Dart_GetField(obj, NewString("foo"));
EXPECT(Dart_IsNull(foo));
- // Invoke the unnamed constructor with an empty string.
- result = Dart_New(type, NewString(""), 0, NULL);
+ // Allocate and Invoke the unnamed constructor passing in an empty string.
+ result = Dart_New(type, Dart_EmptyString(), 0, NULL);
EXPECT_VALID(result);
instanceof = false;
EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceof));
@@ -5163,7 +5163,15 @@ TEST_CASE(New) {
instanceof = false;
EXPECT_VALID(Dart_ObjectIsType(obj, type, &instanceof));
EXPECT(instanceof);
- result = Dart_InvokeConstructor(obj, NewString(""), 0, NULL);
+ // Use the empty string to invoke the unnamed constructor.
+ result = Dart_InvokeConstructor(obj, Dart_EmptyString(), 0, NULL);
+ EXPECT_VALID(result);
+ int_value = 0;
+ foo = Dart_GetField(result, NewString("foo"));
+ EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
+ EXPECT_EQ(7, int_value);
+ // use Dart_Null to invoke the unnamed constructor.
+ result = Dart_InvokeConstructor(obj, Dart_Null(), 0, NULL);
EXPECT_VALID(result);
int_value = 0;
foo = Dart_GetField(result, NewString("foo"));
« 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