| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 8 import 'package:analysis_server/src/computer/computer_closingLabels.dart'; | 8 import 'package:analysis_server/src/computer/computer_closingLabels.dart'; |
| 9 import 'package:analyzer/dart/analysis/results.dart'; | 9 import 'package:analyzer/dart/analysis/results.dart'; |
| 10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 "c", | 262 "c", |
| 263 ]), | 263 ]), |
| 264 ), | 264 ), |
| 265 ), | 265 ), |
| 266 ], | 266 ], |
| 267 ), | 267 ), |
| 268 ); | 268 ); |
| 269 } | 269 } |
| 270 """; | 270 """; |
| 271 | 271 |
| 272 // ignore: unused_local_variable |
| 272 var labels = await _computeElements(content); | 273 var labels = await _computeElements(content); |
| 273 // TODO(dantup) Results here are currently bad so this test is just checking
that we | 274 // TODO(dantup): Results here are currently bad so this test is just |
| 274 // dont crash. Need to confirm what to do here; the bad labels might not be
fixed | 275 // checking that we don't crash. Need to confirm what to do here; the bad |
| 275 // until the code is using the new shared parser. | 276 // labels might not be fixed until the code is using the new shared parser. |
| 276 // https://github.com/dart-lang/sdk/issues/30370 | 277 // https://github.com/dart-lang/sdk/issues/30370 |
| 277 } | 278 } |
| 278 | 279 |
| 279 Future<List<ClosingLabel>> _computeElements(String sourceContent) async { | 280 Future<List<ClosingLabel>> _computeElements(String sourceContent) async { |
| 280 provider.newFile(sourcePath, sourceContent); | 281 provider.newFile(sourcePath, sourceContent); |
| 281 ResolveResult result = await driver.getResult(sourcePath); | 282 ResolveResult result = await driver.getResult(sourcePath); |
| 282 DartUnitClosingLabelsComputer computer = | 283 DartUnitClosingLabelsComputer computer = |
| 283 new DartUnitClosingLabelsComputer(result.lineInfo, result.unit); | 284 new DartUnitClosingLabelsComputer(result.lineInfo, result.unit); |
| 284 return computer.compute(); | 285 return computer.compute(); |
| 285 } | 286 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 312 var expectedLength = endMatch.start - expectedStart; | 313 var expectedLength = endMatch.start - expectedStart; |
| 313 var expectedLabel = endMatch.group(1); | 314 var expectedLabel = endMatch.group(1); |
| 314 | 315 |
| 315 expect( | 316 expect( |
| 316 labels, | 317 labels, |
| 317 contains( | 318 contains( |
| 318 new ClosingLabel(expectedStart, expectedLength, expectedLabel))); | 319 new ClosingLabel(expectedStart, expectedLength, expectedLabel))); |
| 319 }); | 320 }); |
| 320 } | 321 } |
| 321 } | 322 } |
| OLD | NEW |