| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |