mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:39:48 +00:00
[CFE] Replace line/column with * should also work when running with out/ReleaseX64/dart
Follow-up to https://dart-review.googlesource.com/c/sdk/+/347901 as it didn't work when running the tests with out/ReleaseX64/dart. Change-Id: I012d53217e87e087078de3fbff122dfca23b1e9c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348261 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
8b823dc300
commit
b6afc25769
|
@ -527,7 +527,6 @@ class MatchExpectation
|
|||
Iterable<Library> libraries =
|
||||
componentToText.libraries.where(result.isUserLibrary);
|
||||
Uri base = uri.resolve(".");
|
||||
Uri dartBase = Uri.base;
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
|
@ -598,14 +597,15 @@ class MatchExpectation
|
|||
String binariesPath =
|
||||
relativizeUri(Uri.base, platformBinariesLocation, isWindows);
|
||||
if (binariesPath.endsWith("/dart-sdk/lib/_internal/")) {
|
||||
// We are running from the built SDK.
|
||||
// We are running from something like out/ReleaseX64/dart-sdk/bin/dart
|
||||
String search = binariesPath.substring(
|
||||
0, binariesPath.length - "lib/_internal/".length);
|
||||
actual = _replaceSdkLocation(actual, search, "sdk/");
|
||||
} else {
|
||||
// We are running from something like out/ReleaseX64/dart
|
||||
actual = _replaceSdkLocation(actual, "sdk/", "sdk/");
|
||||
}
|
||||
actual = actual.replaceAll("$base", "org-dartlang-testcase:///");
|
||||
actual = _replaceSdkLocation(
|
||||
actual, "$dartBase", "org-dartlang-testcase-sdk:///");
|
||||
actual = actual.replaceAll("\\n", "\n");
|
||||
return context.match<ComponentResult>(suffix, actual, uri, result,
|
||||
onMismatch: serializeFirst
|
||||
|
@ -629,9 +629,11 @@ class MatchExpectation
|
|||
/// of the SDK or the position within the SDK file.
|
||||
String _replaceSdkLocation(String text, String path, String replacement) {
|
||||
// Replace path with line/column.
|
||||
RegExp regExp = new RegExp('${RegExp.escape(path)}([^:\r\n]*):\\d+:\\d+:');
|
||||
RegExp regExp = new RegExp(
|
||||
'^// ${RegExp.escape(path)}([^:\r\n]*):\\d+:\\d+:',
|
||||
multiLine: true);
|
||||
text = text.replaceAllMapped(
|
||||
regExp, (Match match) => '$replacement${match[1]}:*:');
|
||||
regExp, (Match match) => '// $replacement${match[1]}:*:');
|
||||
// Replace path with no line/column.
|
||||
return text.replaceAll(path, replacement);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue