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

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

Issue 2696323004: Tests for analysis.navigation. (Closed)
Patch Set: review updates 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/analysis/navigation_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This fails - it returns navigation results for a whitespace area (#28799).
45 @failingTest
46 test_navigation_no_result() async {
47 String pathname = sourcePath('test.dart');
48 String text = r'''
49 //
50
51 class Foo {}
52
53 class Bar {
54 Foo foo;
55 }
56 ''';
57 writeFile(pathname, text);
58 standardAnalysisSetup();
59
60 await analysisFinished;
61
62 AnalysisGetNavigationResult result =
63 await sendAnalysisGetNavigation(pathname, 0, 0);
64 expect(result.targets, isEmpty);
65 }
66
67 @override
68 bool get enableNewAnalysisDriver => true;
69 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/analysis/navigation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698