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

Unified Diff: pkg/analysis_server/test/integration/analysis/get_hover_test.dart

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/integration/analysis/get_hover_test.dart
diff --git a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
index 08431bc5e3d4e8715b2106ee00512910b8fa2291..0356b8173f1c52a4aa626aaa46437a942393c8d2 100644
--- a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
@@ -13,6 +13,10 @@ import 'package:unittest/unittest.dart';
import '../../reflective_tests.dart';
import '../integration_tests.dart';
+main() {
+ runReflectiveTests(AnalysisGetHoverIntegrationTest);
+}
+
@ReflectiveTestCase()
class AnalysisGetHoverIntegrationTest extends
AbstractAnalysisServerIntegrationTest {
@@ -24,8 +28,7 @@ class AnalysisGetHoverIntegrationTest extends
/**
* Dart code under test.
*/
- final String text =
- r'''
+ final String text = r'''
library lib.test;
List topLevelVar;
@@ -45,54 +48,6 @@ main() {
}
''';
- setUp() {
- return super.setUp().then((_) {
- pathname = sourcePath('test.dart');
- });
- }
-
- test_getHover() {
- writeFile(pathname, text);
- standardAnalysisSetup();
-
- // Note: analysis.getHover doesn't wait for analysis to complete--it simply
- // returns the latest results that are available at the time that the
- // request is made. So wait for analysis to finish before testing anything.
- return analysisFinished.then((_) {
- List<Future> tests = [];
- tests.add(checkHover('topLevelVar;', 11, ['List', 'topLevelVar'],
- 'top level variable', ['List']));
- tests.add(checkHover('func(', 4, ['func', 'int', 'param'], 'function',
- ['int', 'void'], docRegexp: 'Documentation for func'));
- tests.add(checkHover('int param', 3, ['int'], 'class', ['int'], isCore:
- true, docRegexp: '.*'));
- tests.add(checkHover('param)', 5, ['int', 'param'], 'parameter', ['int'],
- docRegexp: 'Documentation for func'));
- tests.add(checkHover('num localVar', 3, ['num'], 'class', ['num'], isCore:
- true, docRegexp: '.*'));
- tests.add(checkHover('localVar =', 8, ['num', 'localVar'],
- 'local variable', ['num'], propagatedType: 'int'));
- tests.add(checkHover('topLevelVar.length;', 11, ['List', 'topLevelVar'],
- 'top level variable', ['List']));
- tests.add(checkHover('length;', 6, ['get', 'length', 'int'], 'getter',
- ['int'], isCore: true, docRegexp: '.*'));
- tests.add(checkHover('length =', 6, ['set', 'length', 'int'], 'setter',
- ['int'], isCore: true, docRegexp: '.*'));
- tests.add(checkHover('param;', 5, ['int', 'param'], 'parameter', ['int'],
- docRegexp: 'Documentation for func', parameterRegexps: ['.*']));
- tests.add(checkHover('add(', 3, ['List', 'add'], 'method', null, isCore:
- true, docRegexp: '.*'));
- tests.add(checkHover('localVar)', 8, ['num', 'localVar'],
- 'local variable', ['num'], parameterRegexps: ['.*'], propagatedType: 'int'));
- tests.add(checkHover('func(35', 4, ['func', 'int', 'param'], 'function',
- null, docRegexp: 'Documentation for func'));
- tests.add(checkHover('35', 2, null, null, ['int'], isLiteral: true,
- parameterRegexps: ['int', 'param']));
- tests.add(checkNoHover('comment'));
- return Future.wait(tests);
- });
- }
-
/**
* Check that a getHover request on the substring [target] produces a result
* which has length [length], has an elementDescription matching every
@@ -106,9 +61,9 @@ main() {
* match the hover parameters. [propagatedType], if specified, is the
* expected propagated type of the element.
*/
- checkHover(String target, int length, List<String> descriptionRegexps, String
- kind, List<String> staticTypeRegexps, {bool isCore: false, String docRegexp:
- null, bool isLiteral: false, List<String> parameterRegexps:
+ checkHover(String target, int length, List<String> descriptionRegexps,
+ String kind, List<String> staticTypeRegexps, {bool isCore: false,
+ String docRegexp: null, bool isLiteral: false, List<String> parameterRegexps:
null, propagatedType: null}) {
int offset = text.indexOf(target);
return sendAnalysisGetHover(pathname, offset).then((result) {
@@ -170,8 +125,142 @@ main() {
expect(result.hovers, hasLength(0));
});
}
-}
-main() {
- runReflectiveTests(AnalysisGetHoverIntegrationTest);
+ setUp() {
+ return super.setUp().then((_) {
+ pathname = sourcePath('test.dart');
+ });
+ }
+
+ test_getHover() {
+ writeFile(pathname, text);
+ standardAnalysisSetup();
+
+ // Note: analysis.getHover doesn't wait for analysis to complete--it simply
+ // returns the latest results that are available at the time that the
+ // request is made. So wait for analysis to finish before testing anything.
+ return analysisFinished.then((_) {
+ List<Future> tests = [];
+ tests.add(
+ checkHover(
+ 'topLevelVar;',
+ 11,
+ ['List', 'topLevelVar'],
+ 'top level variable',
+ ['List']));
+ tests.add(
+ checkHover(
+ 'func(',
+ 4,
+ ['func', 'int', 'param'],
+ 'function',
+ ['int', 'void'],
+ docRegexp: 'Documentation for func'));
+ tests.add(
+ checkHover(
+ 'int param',
+ 3,
+ ['int'],
+ 'class',
+ ['int'],
+ isCore: true,
+ docRegexp: '.*'));
+ tests.add(
+ checkHover(
+ 'param)',
+ 5,
+ ['int', 'param'],
+ 'parameter',
+ ['int'],
+ docRegexp: 'Documentation for func'));
+ tests.add(
+ checkHover(
+ 'num localVar',
+ 3,
+ ['num'],
+ 'class',
+ ['num'],
+ isCore: true,
+ docRegexp: '.*'));
+ tests.add(
+ checkHover(
+ 'localVar =',
+ 8,
+ ['num', 'localVar'],
+ 'local variable',
+ ['num'],
+ propagatedType: 'int'));
+ tests.add(
+ checkHover(
+ 'topLevelVar.length;',
+ 11,
+ ['List', 'topLevelVar'],
+ 'top level variable',
+ ['List']));
+ tests.add(
+ checkHover(
+ 'length;',
+ 6,
+ ['get', 'length', 'int'],
+ 'getter',
+ ['int'],
+ isCore: true,
+ docRegexp: '.*'));
+ tests.add(
+ checkHover(
+ 'length =',
+ 6,
+ ['set', 'length', 'int'],
+ 'setter',
+ ['int'],
+ isCore: true,
+ docRegexp: '.*'));
+ tests.add(
+ checkHover(
+ 'param;',
+ 5,
+ ['int', 'param'],
+ 'parameter',
+ ['int'],
+ docRegexp: 'Documentation for func',
+ parameterRegexps: ['.*']));
+ tests.add(
+ checkHover(
+ 'add(',
+ 3,
+ ['List', 'add'],
+ 'method',
+ null,
+ isCore: true,
+ docRegexp: '.*'));
+ tests.add(
+ checkHover(
+ 'localVar)',
+ 8,
+ ['num', 'localVar'],
+ 'local variable',
+ ['num'],
+ parameterRegexps: ['.*'],
+ propagatedType: 'int'));
+ tests.add(
+ checkHover(
+ 'func(35',
+ 4,
+ ['func', 'int', 'param'],
+ 'function',
+ null,
+ docRegexp: 'Documentation for func'));
+ tests.add(
+ checkHover(
+ '35',
+ 2,
+ null,
+ null,
+ ['int'],
+ isLiteral: true,
+ parameterRegexps: ['int', 'param']));
+ tests.add(checkNoHover('comment'));
+ return Future.wait(tests);
+ });
+ }
}

Powered by Google App Engine
This is Rietveld 408576698