Make update_static_error_tests work on Windows (again)

+ update some test expectations

Change-Id: I63ca86309ea3352a88686f5e3f416311ee7bc03c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162185
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther 2020-09-10 06:21:13 +00:00 committed by commit-bot@chromium.org
parent 4585d4af0a
commit 0e93845ba1
3 changed files with 15 additions and 15 deletions

View file

@ -19,9 +19,9 @@ import 'package:test_runner/src/update_errors.dart';
const _usage =
"Usage: dart update_static_error_tests.dart [flags...] <path glob>";
final _dartPath = _findBinary("dart");
final _analyzerPath = _findBinary("dartanalyzer");
final _dart2jsPath = _findBinary("dart2js");
final _dartPath = _findBinary("dart", "exe");
final _analyzerPath = _findBinary("dartanalyzer", "bat");
final _dart2jsPath = _findBinary("dart2js", "bat");
Future<void> main(List<String> args) async {
var sources = ErrorSource.all.map((e) => e.marker).toList();
@ -301,8 +301,8 @@ Future<List<StaticError>> runDart2js(
}
/// Find the most recently-built [binary] in any of the build directories.
String _findBinary(String binary) {
if (Platform.isWindows) binary += ".bat";
String _findBinary(String name, String windowsExtension) {
String binary = Platform.isWindows ? "$name.$windowsExtension" : name;
String newestPath;
DateTime newestTime;
@ -310,13 +310,13 @@ String _findBinary(String binary) {
var buildDirectory = Directory(Platform.isMacOS ? "xcodebuild" : "out");
if (buildDirectory.existsSync()) {
for (var config in buildDirectory.listSync()) {
var analyzerPath = p.join(config.path, "dart-sdk", "bin", binary);
var analyzerFile = File(analyzerPath);
if (!analyzerFile.existsSync()) continue;
var modified = analyzerFile.lastModifiedSync();
var path = p.join(config.path, "dart-sdk", "bin", binary);
var file = File(path);
if (!file.existsSync()) continue;
var modified = file.lastModifiedSync();
if (newestTime == null || modified.isAfter(newestTime)) {
newestPath = analyzerPath;
newestPath = path;
newestTime = modified;
}
}

View file

@ -31,15 +31,15 @@ main() {
f(intToObject);
//^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
// [cfe] The top level function has type 'Object Function(int)' that isn't of expected type 'num Function(num)'.
// [cfe] The argument type 'Object Function(int)' can't be assigned to the parameter type 'num Function(num)'.
f(intToNum);
//^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
// [cfe] The top level function has type 'num Function(int)' that isn't of expected type 'num Function(num)'.
// [cfe] The argument type 'num Function(int)' can't be assigned to the parameter type 'num Function(num)'.
f(numToObject);
//^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.ARGUMENT_TYPE_NOT_ASSIGNABLE
// [cfe] The top level function has type 'Object Function(num)' that isn't of expected type 'num Function(num)'.
// [cfe] The argument type 'Object Function(num)' can't be assigned to the parameter type 'num Function(num)'.
// Ok.
f(numToNum);

View file

@ -19,7 +19,7 @@ foo3() async {
return "String";
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'String' can't be assigned to a variable of type 'FutureOr<int>'.
// [cfe] A value of type 'String' can't be returned from an async function with return type 'Future<int>'.
}
Future<int, String>
@ -34,7 +34,7 @@ int
// [error line 33, column 1, length 3]
// [analyzer] COMPILE_TIME_ERROR.ILLEGAL_ASYNC_RETURN_TYPE
foo5() async {
// [error line 36, column 1, length 3]
// [error line 36, column 1]
// [cfe] Functions marked 'async' must have a return type assignable to 'Future'.
return 3;
}