Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: pkg/analysis_server/test/integration/analysis/get_navigation_test.dart

Issue 2696323004: Tests for analysis.navigation. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:analysis_server/plugin/protocol/protocol.dart';
6 import 'package:test/test.dart';
7 import 'package:test_reflective_loader/test_reflective_loader.dart';
8
9 import '../integration_tests.dart';
10
11 main() {
12 defineReflectiveSuite(() {
13 defineReflectiveTests(GetNavigationTest);
14 });
15 }
16
17 @reflectiveTest
18 class GetNavigationTest extends AbstractAnalysisServerIntegrationTest {
19 test_navigation() async {
20 String pathname = sourcePath('test.dart');
21 String text = r'''
22 class Foo {}
23
24 class Bar {
25 Foo foo;
26 }
27 ''';
28 writeFile(pathname, text);
29 standardAnalysisSetup();
30
31 await analysisFinished;
32
33 AnalysisGetNavigationResult result =
34 await sendAnalysisGetNavigation(pathname, text.indexOf('Foo foo'), 0);
35 expect(result.targets, hasLength(1));
36 NavigationTarget target = result.targets.first;
37 expect(target.kind, ElementKind.CLASS);
38 expect(target.offset, text.indexOf('Foo {}'));
39 expect(target.length, 3);
40 expect(target.startLine, 1);
41 expect(target.startColumn, 7);
42 }
43
44 test_navigation_no_result() async {
45 String pathname = sourcePath('test.dart');
46 String text = r'''
47 //
48
49 class Foo {}
50
51 class Bar {
52 Foo foo;
53 }
54 ''';
55 writeFile(pathname, text);
56 standardAnalysisSetup();
57
58 await analysisFinished;
59
60 AnalysisGetNavigationResult result =
61 await sendAnalysisGetNavigation(pathname, 0, 0);
62 expect(result.targets, isEmpty);
63 }
64
65 @override
66 bool get enableNewAnalysisDriver => true;
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698