[analyzer_cli] [dartdev] Fix several tests on Windows
Some of the tests would write file paths (instead of URIs) into package_config.jsons, and another assumed memory usage of Dart processes was always low enough that the Memory column header would not be padded with extra spaces to account for wider numbers.
Change-Id: I630aa62a81e20502dc51667893ce099d01a7fad6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 343222c..c27b4ee 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -64,6 +64,7 @@
List<String> args = const <String>[],
}) async {
options = _posixToPlatformPath(options);
+ sources = sources.map(_posixToPlatformPath).cast<String>().toList();
driver = Driver();
var cmd = <String>[];
diff --git a/pkg/dartdev/test/commands/analyze_test.dart b/pkg/dartdev/test/commands/analyze_test.dart
index 9973ce8..50653d7 100644
--- a/pkg/dartdev/test/commands/analyze_test.dart
+++ b/pkg/dartdev/test/commands/analyze_test.dart
@@ -485,7 +485,7 @@
"packages": [
{
"name": "foo",
- "rootUri": "file://${foo.dirPath}",
+ "rootUri": "${Uri.file(foo.dirPath)}",
"packageUri": "lib/",
"languageVersion": "2.12"
}
diff --git a/pkg/dartdev/test/commands/info_windows_test.dart b/pkg/dartdev/test/commands/info_windows_test.dart
index 012009d..6496bde 100644
--- a/pkg/dartdev/test/commands/info_windows_test.dart
+++ b/pkg/dartdev/test/commands/info_windows_test.dart
@@ -53,8 +53,8 @@
expect(output, contains('providing this information'));
expect(output, contains('## Process info'));
- expect(output, contains('| Memory'));
- expect(output, contains('| dart.exe '));
+ expect(output, contains(RegExp(r'\|\s+Memory')));
+ expect(output, contains(RegExp(r'\|\s+dart.exe ')));
});
}, timeout: longTimeout, skip: !Platform.isWindows);
}
diff --git a/pkg/dartdev/test/commands/run_test.dart b/pkg/dartdev/test/commands/run_test.dart
index a5101b9..0c5a3c8 100644
--- a/pkg/dartdev/test/commands/run_test.dart
+++ b/pkg/dartdev/test/commands/run_test.dart
@@ -1039,8 +1039,8 @@
"packages": [
{
"name": "bar",
- "rootUri": "${bar1.dirPath}",
- "packageUri": "${path.join(bar1.dirPath, 'lib')}"
+ "rootUri": "${Uri.file(bar1.dirPath)}",
+ "packageUri": "${Uri.file(path.join(bar1.dirPath, 'lib'))}"
}
]
}
@@ -1051,8 +1051,8 @@
"packages": [
{
"name": "bar",
- "rootUri": "${bar2.dirPath}",
- "packageUri": "${path.join(bar2.dirPath, 'lib')}"
+ "rootUri": "${Uri.file(bar2.dirPath)}",
+ "packageUri": "${Uri.file(path.join(bar2.dirPath, 'lib'))}"
}
]
}