| 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 library test.integration.analysis.outline; | 5 library test.integration.analysis.outline; |
| 6 | 6 |
| 7 import '../../reflective_tests.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; |
| 10 import '../integration_tests.dart'; | 11 import '../integration_tests.dart'; |
| 11 | 12 |
| 12 @ReflectiveTestCase() | 13 @ReflectiveTestCase() |
| 13 class Test extends AbstractAnalysisServerIntegrationTest { | 14 class Test extends AbstractAnalysisServerIntegrationTest { |
| 14 test_outline() { | 15 test_outline() { |
| 15 String pathname = sourcePath('test.dart'); | 16 String pathname = sourcePath('test.dart'); |
| 16 String text = | 17 String text = |
| 17 r''' | 18 r''' |
| 18 class Class1 { | 19 class Class1 { |
| 19 int field; | 20 int field; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 set setter(value) { | 32 set setter(value) { |
| 32 } | 33 } |
| 33 } | 34 } |
| 34 | 35 |
| 35 class Class2 { | 36 class Class2 { |
| 36 } | 37 } |
| 37 '''; | 38 '''; |
| 38 writeFile(pathname, text); | 39 writeFile(pathname, text); |
| 39 standardAnalysisSetup(); | 40 standardAnalysisSetup(); |
| 40 sendAnalysisSetSubscriptions({ | 41 sendAnalysisSetSubscriptions({ |
| 41 'OUTLINE': [pathname] | 42 AnalysisService.OUTLINE: [pathname] |
| 42 }); | 43 }); |
| 43 Map outline; | 44 Map outline; |
| 44 onAnalysisOutline.listen((params) { | 45 onAnalysisOutline.listen((params) { |
| 45 expect(params['file'], equals(pathname)); | 46 expect(params['file'], equals(pathname)); |
| 46 outline = params['outline']; | 47 outline = params['outline']; |
| 47 }); | 48 }); |
| 48 return analysisFinished.then((_) { | 49 return analysisFinished.then((_) { |
| 49 expect(outline['element']['kind'], equals('COMPILATION_UNIT')); | 50 expect(outline['element']['kind'], equals('COMPILATION_UNIT')); |
| 50 expect(outline['offset'], equals(0)); | 51 expect(outline['offset'], equals(0)); |
| 51 expect(outline['length'], equals(text.length)); | 52 expect(outline['length'], equals(text.length)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 74 for (int i = 0; i < outlineObjects.length - 1; i++) { | 75 for (int i = 0; i < outlineObjects.length - 1; i++) { |
| 75 expect(outlineObjects[i + 1]['offset'], equals(outlineObjects[i]['offset'] | 76 expect(outlineObjects[i + 1]['offset'], equals(outlineObjects[i]['offset'] |
| 76 + outlineObjects[i]['length'])); | 77 + outlineObjects[i]['length'])); |
| 77 } | 78 } |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 main() { | 82 main() { |
| 82 runReflectiveTests(Test); | 83 runReflectiveTests(Test); |
| 83 } | 84 } |
| OLD | NEW |