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

Side by Side Diff: tests/compiler/dart2js/line_column_provider_test.dart

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Updated cf. comments Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Unittest for the [LineColumnCollector]. 5 // Unittest for the [LineColumnCollector].
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import 'package:compiler/src/io/code_output.dart'; 8 import 'package:compiler/src/io/code_output.dart';
9 import 'package:compiler/src/io/line_column_provider.dart'; 9 import 'package:compiler/src/io/line_column_provider.dart';
10 10
11 import 'output_collector.dart'; 11 import 'output_collector.dart';
12 12
13 test(List events, Map<int, List<int>> expectedPositions) { 13 test(List events, Map<int, List<int>> expectedPositions) {
14 BufferedEventSink sink = new BufferedEventSink(); 14 BufferedOutputSink sink = new BufferedOutputSink();
15 LineColumnProvider lineColumnProvider = new LineColumnCollector(); 15 LineColumnProvider lineColumnProvider = new LineColumnCollector();
16 CodeOutput output = new StreamCodeOutput(sink, [lineColumnProvider]); 16 CodeOutput output = new StreamCodeOutput(sink, [lineColumnProvider]);
17 for (var event in events) { 17 for (var event in events) {
18 if (event is String) { 18 if (event is String) {
19 output.add(event); 19 output.add(event);
20 } else if (event is CodeBuffer) { 20 } else if (event is CodeBuffer) {
21 output.addBuffer(event); 21 output.addBuffer(event);
22 } 22 }
23 } 23 }
24 output.close(); 24 output.close();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 test(["a", buffer2], positions); 100 test(["a", buffer2], positions);
101 101
102 CodeBuffer buffer3 = new CodeBuffer(); 102 CodeBuffer buffer3 = new CodeBuffer();
103 buffer3.add("a"); 103 buffer3.add("a");
104 test([buffer3, buffer2], positions); 104 test([buffer3, buffer2], positions);
105 105
106 CodeBuffer buffer4 = new CodeBuffer(); 106 CodeBuffer buffer4 = new CodeBuffer();
107 buffer4.addBuffer(buffer3); 107 buffer4.addBuffer(buffer3);
108 test([buffer4, buffer2], positions); 108 test([buffer4, buffer2], positions);
109 } 109 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/expect_annotations2_test.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698