Skip to content

Commit 176dead

Browse files
DanTupCommit Queue
authored andcommitted
[analysis_server] Remove useLineEndingsForPlatform
Nobody sets this variable anymore. Any tests going through shared helpers that use `normalizeSource()` are always normalized now. Change-Id: Idfe3b6430453ad2f92bee950b7a0d60c4a74d135 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444281 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent a6c951d commit 176dead

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

pkg/analysis_server/test/abstract_context.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ class AbstractContextTest
3333

3434
static final ByteStore _byteStore = MemoryByteStore();
3535

36-
/// Whether to rewrite line endings in test code based on platform.
37-
bool useLineEndingsForPlatform = true;
38-
3936
final Map<String, String> _declaredVariables = {};
4037
AnalysisContextCollectionImpl? _analysisContextCollection;
4138

@@ -203,9 +200,8 @@ class AbstractContextTest
203200
}
204201

205202
/// Convenience function to normalize newlines in [code] for the current
206-
/// platform if [useLineEndingsForPlatform] is `true`.
207-
String normalizeSource(String code) =>
208-
useLineEndingsForPlatform ? normalizeNewlinesForPlatform(code) : code;
203+
/// platform.
204+
String normalizeSource(String code) => normalizeNewlinesForPlatform(code);
209205

210206
Future<AnalysisSession> sessionFor(File file) async {
211207
var analysisContext = _contextFor(file);

pkg/analyzer/lib/src/test_utilities/platform.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ String get testEol =>
1212
// existing `TEST_ANALYZER_WINDOWS_PATHS` var) to allow testing
1313
// `\n` on Windows or `\r\n` on non-Windows, to ensure we don't have any
1414
// code just assuming the platform EOL (instead of the files EOL).
15+
// [normalizeNewlinesForPlatform] may need updating to not assume it only
16+
// needs to run for Windows.
1517
Platform.lineTerminator;
1618

1719
/// Normalizes content to use platform-specific newlines.
1820
///
1921
/// This ensures that when running on Windows, '\r\n' is used, even though
2022
/// source files are checked out using '\n'.
2123
String normalizeNewlinesForPlatform(String input) {
22-
// TODO(dantup): Once all instances of useLineEndingsForPlatform have been
23-
// removed, we should try to minimize the number of explicit calls here from
24+
// TODO(dantup): Try to minimize the number of explicit calls here from
2425
// tests and have them automatically normalized.
2526

2627
// Skip normalising for other platforms, as the 'gitattributes' for the Dart

0 commit comments

Comments
 (0)