[ VM ] Fix DartAPI_Invoke* tests in Product mode

Fixes https://github.com/dart-lang/sdk/issues/44896

TEST=N/A
TBR=asiva@google.com

Fixed: 44896
Change-Id: I2cc7a0d9669e5e81cacb7080da32e4eaf7317a86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183901
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ben Konyi 2021-02-09 18:40:02 +00:00 committed by commit-bot@chromium.org
parent f40113cda5
commit 40ed649ef6

View file

@ -5809,15 +5809,16 @@ TEST_CASE(DartAPI_New_Issue44205) {
"\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
Dart_Handle int_wrapper_type =
Dart_GetNonNullableType(lib, NewString("MyIntClass"), 0, NULL);
EXPECT_VALID(int_wrapper_type);
Dart_Handle args[1];
args[0] = Dart_EmptyString();
Dart_Handle result = Dart_New(int_wrapper_type, Dart_EmptyString(), 1, args);
EXPECT_ERROR(result,
"type 'String' is not a subtype of type 'int' of 'value'");
EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
Dart_Handle int_type = Dart_Invoke(lib, NewString("getIntType"), 0, args);
EXPECT_VALID(int_type);
@ -5831,12 +5832,11 @@ TEST_CASE(DartAPI_New_Issue44205) {
// Generic generative constructor
args[0] = Dart_EmptyString();
result = Dart_New(my_class_type, Dart_EmptyString(), 1, args);
EXPECT_ERROR(result,
"type 'String' is not a subtype of type 'int' of 'value'");
EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
// Generic factory constructor
result = Dart_New(my_class_type, NewString("foo"), 1, args);
EXPECT_ERROR(result, "type 'String' is not a subtype of type 'int' of 'x'");
EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'x'");
}
TEST_CASE(DartAPI_InvokeConstructor_Issue44205) {
@ -5855,8 +5855,10 @@ TEST_CASE(DartAPI_InvokeConstructor_Issue44205) {
"\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
Dart_Handle int_wrapper_type =
Dart_GetNonNullableType(lib, NewString("MyIntClass"), 0, NULL);
EXPECT_VALID(int_wrapper_type);
Dart_Handle args[1];
args[0] = Dart_EmptyString();
@ -5864,8 +5866,7 @@ TEST_CASE(DartAPI_InvokeConstructor_Issue44205) {
EXPECT_VALID(result);
result = Dart_InvokeConstructor(result, Dart_EmptyString(), 1, args);
EXPECT_ERROR(result,
"type 'String' is not a subtype of type 'int' of 'value'");
EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
Dart_Handle int_type = Dart_Invoke(lib, NewString("getIntType"), 0, args);
EXPECT_VALID(int_type);
@ -5879,8 +5880,7 @@ TEST_CASE(DartAPI_InvokeConstructor_Issue44205) {
result = Dart_Allocate(my_class_type);
EXPECT_VALID(result);
result = Dart_InvokeConstructor(result, Dart_EmptyString(), 1, args);
EXPECT_ERROR(result,
"type 'String' is not a subtype of type 'int' of 'value'");
EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
}
TEST_CASE(DartAPI_InvokeClosure_Issue44205) {
@ -5904,6 +5904,7 @@ TEST_CASE(DartAPI_InvokeClosure_Issue44205) {
// Create a test library and Load up a test script in it.
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
// Invoke a function which returns a closure.
Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain1"), 0, NULL);
@ -5913,7 +5914,7 @@ TEST_CASE(DartAPI_InvokeClosure_Issue44205) {
Dart_Handle dart_arguments[1];
dart_arguments[0] = Dart_EmptyString();
result = Dart_InvokeClosure(retobj, 1, dart_arguments);
EXPECT_ERROR(result, "type 'String' is not a subtype of type 'int' of 'j'");
EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'j'");
}
TEST_CASE(DartAPI_New_Issue2971) {