| 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 [LocationCollector]. | 5 // Unittest for the [LocationCollector]. |
| 6 | 6 |
| 7 import 'package:compiler/src/io/code_output.dart'; | 7 import 'package:compiler/src/io/code_output.dart'; |
| 8 import 'package:compiler/src/io/location_provider.dart'; | 8 import 'package:compiler/src/io/location_provider.dart'; |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import 'package:kernel/ast.dart' show Location; | 10 import 'package:kernel/ast.dart' show Location; |
| 11 | 11 |
| 12 import 'output_collector.dart'; | 12 import 'output_collector.dart'; |
| 13 | 13 |
| 14 test(List events, Map<int, List<int>> expectedPositions) { | 14 test(List events, Map<int, List<int>> expectedPositions) { |
| 15 BufferedOutputSink sink = new BufferedOutputSink(); | 15 BufferedOutputSink sink = new BufferedOutputSink(); |
| 16 LocationProvider locationProvider = new LocationCollector(); | 16 LocationProvider locationProvider = new LocationCollector(); |
| 17 // ignore: LIST_ELEMENT_TYPE_NOT_ASSIGNABLE |
| 17 CodeOutput output = new StreamCodeOutput(sink, [locationProvider]); | 18 CodeOutput output = new StreamCodeOutput(sink, [locationProvider]); |
| 18 for (var event in events) { | 19 for (var event in events) { |
| 19 if (event is String) { | 20 if (event is String) { |
| 20 output.add(event); | 21 output.add(event); |
| 21 } else if (event is CodeBuffer) { | 22 } else if (event is CodeBuffer) { |
| 22 output.addBuffer(event); | 23 output.addBuffer(event); |
| 23 } | 24 } |
| 24 } | 25 } |
| 25 output.close(); | 26 output.close(); |
| 26 | 27 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 test(["a", buffer2], positions); | 103 test(["a", buffer2], positions); |
| 103 | 104 |
| 104 CodeBuffer buffer3 = new CodeBuffer(); | 105 CodeBuffer buffer3 = new CodeBuffer(); |
| 105 buffer3.add("a"); | 106 buffer3.add("a"); |
| 106 test([buffer3, buffer2], positions); | 107 test([buffer3, buffer2], positions); |
| 107 | 108 |
| 108 CodeBuffer buffer4 = new CodeBuffer(); | 109 CodeBuffer buffer4 = new CodeBuffer(); |
| 109 buffer4.addBuffer(buffer3); | 110 buffer4.addBuffer(buffer3); |
| 110 test([buffer4, buffer2], positions); | 111 test([buffer4, buffer2], positions); |
| 111 } | 112 } |
| OLD | NEW |