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

Unified Diff: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart

Issue 1834423002: Sort the files in analysis_server (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index e7f4feacd5b4271669e7ce164a0f1c9e84290fa1..c4358484e10200b10d4ae34902838cf58ad98508 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -77,12 +77,13 @@ class ArgListContributorTest extends DartCompletionContributorTest {
}
/**
- * Assert that the specified suggestions are the only suggestions.
+ * Assert that the specified named argument suggestions are the only
+ * suggestions.
*/
- void assertSuggestions(List<String> suggestions) {
+ void assertSuggestArguments({List<String> namedArguments}) {
List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
- for (String suggestion in suggestions) {
- expected.add(assertSuggest('$suggestion',
+ for (String name in namedArguments) {
+ expected.add(assertSuggest('$name: ',
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
relevance: DART_RELEVANCE_NAMED_PARAMETER));
}
@@ -90,13 +91,12 @@ class ArgListContributorTest extends DartCompletionContributorTest {
}
/**
- * Assert that the specified named argument suggestions are the only
- * suggestions.
+ * Assert that the specified suggestions are the only suggestions.
*/
- void assertSuggestArguments({List<String> namedArguments}) {
+ void assertSuggestions(List<String> suggestions) {
List<CompletionSuggestion> expected = new List<CompletionSuggestion>();
- for (String name in namedArguments) {
- expected.add(assertSuggest('$name: ',
+ for (String suggestion in suggestions) {
+ expected.add(assertSuggest('$suggestion',
csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
relevance: DART_RELEVANCE_NAMED_PARAMETER));
}
@@ -108,13 +108,30 @@ class ArgListContributorTest extends DartCompletionContributorTest {
return new ArgListContributor();
}
- test_Annotation_local_constructor_named_param_negative() async {
+ fail_test_Annotation_local_constructor_named_param_10() async {
addTestSource('''
-class A { const A(int one, int two, int three, {int four, String five:
- 'defaultValue'}); }
-@A(1, ^, 3) main() { }''');
+class A { const A({int one, String two: 'defaultValue'}); }
+@A(two: '2' ^) main() { }''');
await computeSuggestions();
- assertNoSuggestions();
+ assertSuggestions([', one: ']);
+ }
+
+ fail_test_Annotation_local_constructor_named_param_9() async {
+ addTestSource('''
+class A { const A({int one, String two: 'defaultValue'}); }
+@A(two: '2'^) main() { }''');
+ await computeSuggestions();
+ assertSuggestions([', one: ']);
+ }
+
+ test_Annotation_imported_constructor_named_param() async {
+ addSource(
+ '/libA.dart',
+ '''
+library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
+ addTestSource('import "/libA.dart"; @A(^) main() { }');
+ await computeSuggestions();
+ assertSuggestArguments(namedArguments: ['one', 'two']);
}
test_Annotation_local_constructor_named_param() async {
@@ -125,6 +142,14 @@ class A { const A({int one, String two: 'defaultValue'}); }
assertSuggestArguments(namedArguments: ['one', 'two']);
}
+ test_Annotation_local_constructor_named_param_11() async {
+ addTestSource('''
+class A { const A({int one, String two: 'defaultValue'}); }
+@A(two: '2', ^) main() { }''');
+ await computeSuggestions();
+ assertSuggestArguments(namedArguments: ['one']);
+ }
+
test_Annotation_local_constructor_named_param_2() async {
addTestSource('''
class A { const A({int one, String two: 'defaultValue'}); }
@@ -181,38 +206,13 @@ class A { const A(int zero, {int one, String two: 'defaultValue'}); }
assertSuggestions(['one: ,']);
}
- fail_test_Annotation_local_constructor_named_param_9() async {
- addTestSource('''
-class A { const A({int one, String two: 'defaultValue'}); }
-@A(two: '2'^) main() { }''');
- await computeSuggestions();
- assertSuggestions([', one: ']);
- }
-
- fail_test_Annotation_local_constructor_named_param_10() async {
- addTestSource('''
-class A { const A({int one, String two: 'defaultValue'}); }
-@A(two: '2' ^) main() { }''');
- await computeSuggestions();
- assertSuggestions([', one: ']);
- }
-
- test_Annotation_local_constructor_named_param_11() async {
+ test_Annotation_local_constructor_named_param_negative() async {
addTestSource('''
-class A { const A({int one, String two: 'defaultValue'}); }
-@A(two: '2', ^) main() { }''');
- await computeSuggestions();
- assertSuggestArguments(namedArguments: ['one']);
- }
-
- test_Annotation_imported_constructor_named_param() async {
- addSource(
- '/libA.dart',
- '''
-library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
- addTestSource('import "/libA.dart"; @A(^) main() { }');
+class A { const A(int one, int two, int three, {int four, String five:
+ 'defaultValue'}); }
+@A(1, ^, 3) main() { }''');
await computeSuggestions();
- assertSuggestArguments(namedArguments: ['one', 'two']);
+ assertNoSuggestions();
}
test_ArgumentList_getter() async {

Powered by Google App Engine
This is Rietveld 408576698