mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 13:35:05 +00:00
[vm/gardening] Fix static_function_test to accommodate closure passing.
TEST=lib/isolate/static_function_test Fixes https://github.com/dart-lang/sdk/issues/47107 Change-Id: I4ad552c35297230123574dee5451ab83b731f406 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212489 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
parent
07aa93a532
commit
7495184e2f
|
@ -9,6 +9,7 @@
|
|||
|
||||
library static_function_test;
|
||||
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
import 'static_function_lib.dart' as lib;
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
|
@ -115,6 +116,9 @@ void functionFailTest(name, function) {
|
|||
}
|
||||
|
||||
void main([args, port]) {
|
||||
final bool isolateGroupsEnabled =
|
||||
Platform.executableArguments.contains('--enable-isolate-groups');
|
||||
|
||||
asyncStart();
|
||||
// Sanity check.
|
||||
spawnTest("function", function, "TOP");
|
||||
|
@ -134,16 +138,31 @@ void main([args, port]) {
|
|||
spawnTest("lib._class._function", lib.privateClassFunction, "_LIB");
|
||||
spawnTest("lib._class._function", lib.privateClassAndFunction, "_LIBPRIVATE");
|
||||
|
||||
// Negative tests
|
||||
functionFailTest("static closure", staticClosure);
|
||||
functionFailTest("dynamic closure", dynamicClosure);
|
||||
functionFailTest("named dynamic closure", namedDynamicClosure);
|
||||
functionFailTest("instance closure", new C().instanceClosure);
|
||||
functionFailTest(
|
||||
"initializer closure", new C().constructorInitializerClosure);
|
||||
functionFailTest("constructor closure", new C().constructorBodyClosure);
|
||||
functionFailTest(
|
||||
"named constructor closure", new C().namedConstructorBodyClosure);
|
||||
functionFailTest("instance method", new C().instanceMethod);
|
||||
if (isolateGroupsEnabled) {
|
||||
spawnTest("static closure", staticClosure, "WHAT?");
|
||||
spawnTest("dynamic closure", dynamicClosure, "WHAT??");
|
||||
spawnTest("named dynamic closure", namedDynamicClosure, "WHAT FOO??");
|
||||
spawnTest("instance closure", new C().instanceClosure, "C WHAT?");
|
||||
spawnTest(
|
||||
"initializer closure", new C().constructorInitializerClosure, "Init?");
|
||||
spawnTest(
|
||||
"constructor closure", new C().constructorBodyClosure, "bodyClosure?");
|
||||
spawnTest("named constructor closure", new C().namedConstructorBodyClosure,
|
||||
"namedBodyClosure?");
|
||||
spawnTest("instance method", new C().instanceMethod, "INSTANCE WHAT?");
|
||||
} else {
|
||||
// Negative tests
|
||||
functionFailTest("static closure", staticClosure);
|
||||
functionFailTest("dynamic closure", dynamicClosure);
|
||||
functionFailTest("named dynamic closure", namedDynamicClosure);
|
||||
functionFailTest("instance closure", new C().instanceClosure);
|
||||
functionFailTest(
|
||||
"initializer closure", new C().constructorInitializerClosure);
|
||||
functionFailTest("constructor closure", new C().constructorBodyClosure);
|
||||
functionFailTest(
|
||||
"named constructor closure", new C().namedConstructorBodyClosure);
|
||||
functionFailTest("instance method", new C().instanceMethod);
|
||||
}
|
||||
|
||||
asyncEnd();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
library static_function_test;
|
||||
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
import 'static_function_lib.dart' as lib;
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
|
@ -117,6 +118,9 @@ void functionFailTest(name, function) {
|
|||
}
|
||||
|
||||
void main([args, port]) {
|
||||
final bool isolateGroupsEnabled =
|
||||
Platform.executableArguments.contains('--enable-isolate-groups');
|
||||
|
||||
asyncStart();
|
||||
// Sanity check.
|
||||
spawnTest("function", function, "TOP");
|
||||
|
@ -136,16 +140,31 @@ void main([args, port]) {
|
|||
spawnTest("lib._class._function", lib.privateClassFunction, "_LIB");
|
||||
spawnTest("lib._class._function", lib.privateClassAndFunction, "_LIBPRIVATE");
|
||||
|
||||
// Negative tests
|
||||
functionFailTest("static closure", staticClosure);
|
||||
functionFailTest("dynamic closure", dynamicClosure);
|
||||
functionFailTest("named dynamic closure", namedDynamicClosure);
|
||||
functionFailTest("instance closure", new C().instanceClosure);
|
||||
functionFailTest(
|
||||
"initializer closure", new C().constructorInitializerClosure);
|
||||
functionFailTest("constructor closure", new C().constructorBodyClosure);
|
||||
functionFailTest(
|
||||
"named constructor closure", new C().namedConstructorBodyClosure);
|
||||
functionFailTest("instance method", new C().instanceMethod);
|
||||
if (isolateGroupsEnabled) {
|
||||
spawnTest("static closure", staticClosure, "WHAT?");
|
||||
spawnTest("dynamic closure", dynamicClosure, "WHAT??");
|
||||
spawnTest("named dynamic closure", namedDynamicClosure, "WHAT FOO??");
|
||||
spawnTest("instance closure", new C().instanceClosure, "C WHAT?");
|
||||
spawnTest(
|
||||
"initializer closure", new C().constructorInitializerClosure, "Init?");
|
||||
spawnTest(
|
||||
"constructor closure", new C().constructorBodyClosure, "bodyClosure?");
|
||||
spawnTest("named constructor closure", new C().namedConstructorBodyClosure,
|
||||
"namedBodyClosure?");
|
||||
spawnTest("instance method", new C().instanceMethod, "INSTANCE WHAT?");
|
||||
} else {
|
||||
// Negative tests
|
||||
functionFailTest("static closure", staticClosure);
|
||||
functionFailTest("dynamic closure", dynamicClosure);
|
||||
functionFailTest("named dynamic closure", namedDynamicClosure);
|
||||
functionFailTest("instance closure", new C().instanceClosure);
|
||||
functionFailTest(
|
||||
"initializer closure", new C().constructorInitializerClosure);
|
||||
functionFailTest("constructor closure", new C().constructorBodyClosure);
|
||||
functionFailTest(
|
||||
"named constructor closure", new C().namedConstructorBodyClosure);
|
||||
functionFailTest("instance method", new C().instanceMethod);
|
||||
}
|
||||
|
||||
asyncEnd();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue