d352bc28b8
Since the flag is now enabled by default, there should be no mention of it. There are still some uses in front_end/testcases that are not just removable (it also uses `no-non-nullable`). There migth be more uses that are not as easily found as grepping for `--enable-experiment Removes two VM tests where fixing them meant they were just duplicating the corresponding non *_2/ tests. Fixes #44941 TEST= Large number of tests chaged.=(no-)?non-nullable`. Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
80 lines
2.3 KiB
Dart
80 lines
2.3 KiB
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "dart:io";
|
|
import "package:async_helper/async_minitest.dart";
|
|
|
|
void generateIsolateSource(String filePath, String version) {
|
|
File isolateSource = new File("$filePath");
|
|
isolateSource.writeAsStringSync('''
|
|
// @dart=$version
|
|
library SpawnUriIsolate;
|
|
main(List<String> args, replyTo) {
|
|
var data = args[0];
|
|
try {
|
|
int x = null as int;
|
|
replyTo.send(\'re: weak\');
|
|
} catch (ex) {
|
|
replyTo.send(\'re: strong\');
|
|
}
|
|
}
|
|
''');
|
|
}
|
|
|
|
void generateOutput(String sourcePath, String outPath, String type) {
|
|
var exec = Platform.resolvedExecutable;
|
|
var args = <String>[];
|
|
args.add("--snapshot-kind=$type");
|
|
args.add("--snapshot=$outPath");
|
|
args.add(sourcePath);
|
|
var result = Process.runSync(exec, args);
|
|
}
|
|
|
|
void generateKernel(String sourcePath, String outPath) {
|
|
generateOutput(sourcePath, outPath, "kernel");
|
|
}
|
|
|
|
void generateAppJIT(String sourcePath, String outPath) {
|
|
generateOutput(sourcePath, outPath, "app-jit");
|
|
}
|
|
|
|
void testNullSafetyMode(
|
|
String filePath, String version, String uri, String expected) {
|
|
File mainIsolate = new File(filePath);
|
|
mainIsolate.writeAsStringSync('''
|
|
// @dart=$version
|
|
library spawn_tests;
|
|
|
|
import \'dart:isolate\';
|
|
|
|
void main() async {
|
|
const String debugName = \'spawnedIsolate\';
|
|
final exitPort = ReceivePort();
|
|
final port = new ReceivePort();
|
|
port.listen((msg) {
|
|
print(msg);
|
|
port.close();
|
|
});
|
|
|
|
final isolate = await Isolate.spawnUri(
|
|
Uri.parse(\'$uri\'),
|
|
[\'re: hi\'],
|
|
port.sendPort,
|
|
paused: false,
|
|
debugName: debugName,
|
|
onExit: exitPort.sendPort);
|
|
|
|
// Explicitly await spawned isolate exit to enforce main isolate not
|
|
// completing (and the stand-alone runtime exiting) before the spawned
|
|
// isolate is done.
|
|
await exitPort.first;
|
|
}
|
|
''');
|
|
var exec = Platform.resolvedExecutable;
|
|
var args = <String>[];
|
|
args.add(mainIsolate.path);
|
|
var result = Process.runSync(exec, args);
|
|
expect(result.stdout.contains('$expected'), true);
|
|
}
|