mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
[analysis_server] Fix generation tests on Windows
The check normalises newlines from "actualContents", but "expectedContents" could also contain \r\n on Windows (at least it does for me), so this just normalises both. The additional await/async is to prevent "Test failed after it already completed" warnings because this code is inside the call to test() (and not wrapping it, like the other .main() calls in the file). Change-Id: Iac034efaf1a8a6dad4a21dc67a2dfdb74092dd22 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307301 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
f984411eac
commit
c739cbfd7b
|
@ -68,7 +68,7 @@ void main() {
|
||||||
|
|
||||||
@reflectiveTest
|
@reflectiveTest
|
||||||
class SpecTest {
|
class SpecTest {
|
||||||
void test_specHasBeenGenerated() {
|
void test_specHasBeenGenerated() async {
|
||||||
check_spec.main();
|
await check_spec.main();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ abstract class GeneratedContent {
|
||||||
var executable = Platform.executable;
|
var executable = Platform.executable;
|
||||||
var generateScript = normalize(joinAll(posix.split(generatorPath)));
|
var generateScript = normalize(joinAll(posix.split(generatorPath)));
|
||||||
print(' $executable $generateScript ${args.join(" ")}');
|
print(' $executable $generateScript ${args.join(" ")}');
|
||||||
fail('Error codes need to be generated');
|
fail('Generated content needs to be regenerated');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,6 +409,7 @@ class GeneratedFile extends GeneratedContent {
|
||||||
// Normalize Windows line endings to Unix line endings so that the
|
// Normalize Windows line endings to Unix line endings so that the
|
||||||
// comparison doesn't fail on Windows.
|
// comparison doesn't fail on Windows.
|
||||||
actualContents = actualContents.replaceAll('\r\n', '\n');
|
actualContents = actualContents.replaceAll('\r\n', '\n');
|
||||||
|
expectedContents = expectedContents.replaceAll('\r\n', '\n');
|
||||||
return expectedContents == actualContents;
|
return expectedContents == actualContents;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// There was a problem reading the file (most likely because it didn't
|
// There was a problem reading the file (most likely because it didn't
|
||||||
|
|
Loading…
Reference in a new issue