| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Test of the main method in poi.dart. This test only ensures that poi.dart | 5 /// Test of the main method in poi.dart. This test only ensures that poi.dart |
| 6 /// doesn't crash. | 6 /// doesn't crash. |
| 7 | 7 |
| 8 library trydart.poi_test; | 8 library trydart.poi_test; |
| 9 | 9 |
| 10 import 'dart:io' show | 10 import 'dart:io' show |
| 11 Platform; | 11 Platform; |
| 12 | 12 |
| 13 import 'dart:async' show | 13 import 'dart:async' show |
| 14 Future; | 14 Future; |
| 15 | 15 |
| 16 import 'package:try/poi/poi.dart' as poi; | 16 import 'package:try/poi/poi.dart' as poi; |
| 17 | 17 |
| 18 import 'package:async_helper/async_helper.dart'; | 18 import 'package:async_helper/async_helper.dart'; |
| 19 | 19 |
| 20 class PoiTest { | 20 class PoiTest { |
| 21 final Uri script; | 21 final Uri script; |
| 22 final int offset; | 22 final int offset; |
| 23 | 23 |
| 24 PoiTest(this.script, this.offset); | 24 PoiTest(this.script, this.offset); |
| 25 | 25 |
| 26 Future run() => poi.main(<String>[script.toFilePath(), '$offset']); | 26 Future run() => poi.main(<String>[script.toFilePath(), '$offset']); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void main() { | 29 void main() { |
| 30 int position = 710; | 30 int position = 695; |
| 31 List tests = [ | 31 List tests = [ |
| 32 // The file empty_main.dart is a regression test for crash in | 32 // The file empty_main.dart is a regression test for crash in |
| 33 // resolveMetadataAnnotation in dart2js. | 33 // resolveMetadataAnnotation in dart2js. |
| 34 new PoiTest(Platform.script.resolve('data/empty_main.dart'), 225), | 34 new PoiTest(Platform.script.resolve('data/empty_main.dart'), 225), |
| 35 new PoiTest(Platform.script, position), | 35 new PoiTest(Platform.script, position), |
| 36 ]; | 36 ]; |
| 37 | 37 |
| 38 poi.enableDartMind = false; |
| 39 |
| 38 asyncTest(() => Future.forEach(tests, (PoiTest test) => test.run())); | 40 asyncTest(() => Future.forEach(tests, (PoiTest test) => test.run())); |
| 39 } | 41 } |
| OLD | NEW |