[analysis_server] Fix expected EOL in integration test on Windows

Fixes https://github.com/dart-lang/sdk/issues/61255

Change-Id: Ifb11a0add0219c93e167cf673a916fa35fafad12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443804
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Danny Tuppeny
2025-08-05 09:49:08 -07:00
committed by Commit Queue
parent 21f365f592
commit c562e61a4b
2 changed files with 8 additions and 2 deletions
@@ -55,11 +55,13 @@ class AnalysisGetImportElementsIntegrationTest
expect(edit.file, expectedFile);
}
var actual = edit.edits;
expect(actual, unorderedEquals(expected));
expect(actual, hasLength(expected.length));
for (var expectedEdit in expected) {
var index = find(actual, expectedEdit);
if (index < 0) {
fail('Expected $expectedEdit; not found');
var actualDescription = actual.map((edit) => ' - $edit').join('\n');
fail('Expected $expectedEdit; not found in:\n$actualDescription');
}
actual.removeAt(index);
}
@@ -96,7 +98,7 @@ class AnalysisGetImportElementsIntegrationTest
<ImportedElements>[
ImportedElements(mathPath, '', <String>['Random']),
],
[SourceEdit(0, 0, "import 'dart:math';\n\n")],
[SourceEdit(0, 0, "import 'dart:math';$eol$eol")],
);
}
@@ -11,6 +11,7 @@ import 'package:analysis_server/protocol/protocol_constants.dart';
import 'package:analysis_server/src/protocol_server.dart';
import 'package:analysis_server/src/services/pub/pub_command.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/test_utilities/platform.dart';
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
import 'package:analyzer_testing/mock_packages/mock_packages.dart';
import 'package:analyzer_testing/utilities/utilities.dart';
@@ -176,6 +177,9 @@ abstract class AbstractAnalysisServerIntegrationTest extends IntegrationTest
return completer.future;
}
/// The line terminator being used for test files and to be expected in edits.
String get eol => testEol;
@override
String get packagesRootPath => packagesDirectory.path;