Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1385)

Unified Diff: tests/compiler/dart2js/line_column_provider_test.dart

Issue 1168393003: Enforce LF line endings in the git database. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/line_column_provider_test.dart
diff --git a/tests/compiler/dart2js/line_column_provider_test.dart b/tests/compiler/dart2js/line_column_provider_test.dart
index c1cddedc5a75c1f002753b24aa9c8db9963ab0a2..ae90daf28a259f4bfa83d9cd801891fe66042afe 100644
--- a/tests/compiler/dart2js/line_column_provider_test.dart
+++ b/tests/compiler/dart2js/line_column_provider_test.dart
@@ -1,84 +1,84 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Unittest for the [LineColumnCollector].
-
-import 'package:expect/expect.dart';
-import 'package:compiler/src/io/code_output.dart';
-import 'package:compiler/src/io/line_column_provider.dart';
-
-import 'output_collector.dart';
-
-test(List events, Map<int, List<int>> expectedPositions) {
- BufferedEventSink sink = new BufferedEventSink();
- LineColumnProvider lineColumnProvider = new LineColumnCollector();
- CodeOutput output = new StreamCodeOutput(sink, [lineColumnProvider]);
- for (var event in events) {
- if (event is String) {
- output.add(event);
- } else if (event is CodeBuffer) {
- output.addBuffer(event);
- }
- }
- output.close();
-
- expectedPositions.forEach((int offset, List<int> expectedPosition) {
- if (expectedPosition == null) {
- Expect.throws(() => lineColumnProvider.getLine(offset),
- (e) => true,
- 'Expected out-of-bounds offset: $offset\n'
- 'text:"""${sink.text}"""\n'
- 'lineColumnProvider:$lineColumnProvider');
- } else {
- int line = lineColumnProvider.getLine(offset);
- int column = lineColumnProvider.getColumn(line, offset);
- Expect.equals(expectedPosition[0], line,
- 'Unexpected result: $offset -> $expectedPosition = [$line,$column]\n'
- 'text:"""${sink.text}"""\n'
- 'lineColumnProvider:$lineColumnProvider');
- Expect.equals(expectedPosition[1], column,
- 'Unexpected result: $offset -> $expectedPosition = [$line,$column]\n'
- 'text:"""${sink.text}"""\n'
- 'lineColumnProvider:$lineColumnProvider');
- }
- });
-}
-
-main() {
- test([""], {0: [0, 0], 1: null});
-
- test([" "], {0: [0, 0], 1: [0, 1], 2: null});
-
- test(["\n "], {0: [0, 0], 1: [1, 0], 2: [1, 1], 3: null});
-
- Map positions = {0: [0, 0],
- 1: [0, 1],
- 2: [1, 0],
- 3: [1, 1],
- 4: [2, 0],
- 5: [2, 1],
- 6: null};
-
- test(["a\nb\nc"], positions);
-
- test(["a", "\nb\nc"], positions);
-
- test(["a", "\n", "b\nc"], positions);
-
- CodeBuffer buffer1 = new CodeBuffer();
- buffer1.add("a\nb\nc");
- test([buffer1], positions);
-
- CodeBuffer buffer2 = new CodeBuffer();
- buffer2.add("\nb\nc");
- test(["a", buffer2], positions);
-
- CodeBuffer buffer3 = new CodeBuffer();
- buffer3.add("a");
- test([buffer3, buffer2], positions);
-
- CodeBuffer buffer4 = new CodeBuffer();
- buffer4.addBuffer(buffer3);
- test([buffer4, buffer2], positions);
-}
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Unittest for the [LineColumnCollector].
+
+import 'package:expect/expect.dart';
+import 'package:compiler/src/io/code_output.dart';
+import 'package:compiler/src/io/line_column_provider.dart';
+
+import 'output_collector.dart';
+
+test(List events, Map<int, List<int>> expectedPositions) {
+ BufferedEventSink sink = new BufferedEventSink();
+ LineColumnProvider lineColumnProvider = new LineColumnCollector();
+ CodeOutput output = new StreamCodeOutput(sink, [lineColumnProvider]);
+ for (var event in events) {
+ if (event is String) {
+ output.add(event);
+ } else if (event is CodeBuffer) {
+ output.addBuffer(event);
+ }
+ }
+ output.close();
+
+ expectedPositions.forEach((int offset, List<int> expectedPosition) {
+ if (expectedPosition == null) {
+ Expect.throws(() => lineColumnProvider.getLine(offset),
+ (e) => true,
+ 'Expected out-of-bounds offset: $offset\n'
+ 'text:"""${sink.text}"""\n'
+ 'lineColumnProvider:$lineColumnProvider');
+ } else {
+ int line = lineColumnProvider.getLine(offset);
+ int column = lineColumnProvider.getColumn(line, offset);
+ Expect.equals(expectedPosition[0], line,
+ 'Unexpected result: $offset -> $expectedPosition = [$line,$column]\n'
+ 'text:"""${sink.text}"""\n'
+ 'lineColumnProvider:$lineColumnProvider');
+ Expect.equals(expectedPosition[1], column,
+ 'Unexpected result: $offset -> $expectedPosition = [$line,$column]\n'
+ 'text:"""${sink.text}"""\n'
+ 'lineColumnProvider:$lineColumnProvider');
+ }
+ });
+}
+
+main() {
+ test([""], {0: [0, 0], 1: null});
+
+ test([" "], {0: [0, 0], 1: [0, 1], 2: null});
+
+ test(["\n "], {0: [0, 0], 1: [1, 0], 2: [1, 1], 3: null});
+
+ Map positions = {0: [0, 0],
+ 1: [0, 1],
+ 2: [1, 0],
+ 3: [1, 1],
+ 4: [2, 0],
+ 5: [2, 1],
+ 6: null};
+
+ test(["a\nb\nc"], positions);
+
+ test(["a", "\nb\nc"], positions);
+
+ test(["a", "\n", "b\nc"], positions);
+
+ CodeBuffer buffer1 = new CodeBuffer();
+ buffer1.add("a\nb\nc");
+ test([buffer1], positions);
+
+ CodeBuffer buffer2 = new CodeBuffer();
+ buffer2.add("\nb\nc");
+ test(["a", buffer2], positions);
+
+ CodeBuffer buffer3 = new CodeBuffer();
+ buffer3.add("a");
+ test([buffer3, buffer2], positions);
+
+ CodeBuffer buffer4 = new CodeBuffer();
+ buffer4.addBuffer(buffer3);
+ test([buffer4, buffer2], positions);
+}
« no previous file with comments | « tests/compiler/dart2js/least_upper_bound_test.dart ('k') | tests/compiler/dart2js/mirror_system_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698