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

Unified Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 2394683006: Switch analysis_server to use 'package:test'. (Closed)
Patch Set: Created 4 years, 2 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/domain_completion_test.dart
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 81d8a353ac3b79acc58eda76eefa37231b298c33..91cf4a0034098245eb196ac591f62ec034d1a4b1 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -12,8 +12,8 @@ import 'package:analysis_server/src/provisional/completion/completion_core.dart'
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
import 'package:analysis_server/src/services/completion/dart/contribution_sorter.dart';
+import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import 'package:unittest/unittest.dart';
import 'analysis_abstract.dart';
import 'domain_completion_util.dart';
@@ -22,8 +22,10 @@ import 'utils.dart';
main() {
initializeTestEnvironment();
- defineReflectiveTests(CompletionDomainHandlerTest);
- defineReflectiveTests(_NoSearchEngine);
+ defineReflectiveSuite(() {
+ defineReflectiveTests(CompletionDomainHandlerTest);
+ defineReflectiveTests(_NoSearchEngine);
+ });
}
@reflectiveTest
@@ -48,6 +50,15 @@ class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
expect(suggestions, hasLength(2));
}
+ test_ArgumentList_imported_function_named_param2() async {
+ addTestFile('mainx() {A a = new A(); a.foo(one: 7, ^);}'
+ 'class A { foo({one, two}) {} }');
+ await getSuggestions();
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
+ relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ expect(suggestions, hasLength(1));
+ }
+
test_ArgumentList_imported_function_named_param_label1() async {
addTestFile('main() { int.parse("16", r^: 16);}');
await getSuggestions();
@@ -68,15 +79,6 @@ class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
expect(suggestions, hasLength(2));
}
- test_ArgumentList_imported_function_named_param2() async {
- addTestFile('mainx() {A a = new A(); a.foo(one: 7, ^);}'
- 'class A { foo({one, two}) {} }');
- await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- expect(suggestions, hasLength(1));
- }
-
test_html() {
testFile = '/project/web/test.html';
addTestFile('''
@@ -89,6 +91,20 @@ class CompletionDomainHandlerTest extends AbstractCompletionDomainTest {
});
}
+ test_import_uri_with_trailing() {
+ addFile('/project/bin/testA.dart', 'library libA;');
+ addTestFile('''
+ import '/project/bin/t^.dart';
+ main() {}''');
+ return getSuggestions().then((_) {
+ expect(replacementOffset, equals(completionOffset - 14));
+ expect(replacementLength, equals(5 + 14));
+ assertHasResult(
+ CompletionSuggestionKind.IMPORT, '/project/bin/testA.dart');
+ assertNoResult('test');
+ });
+ }
+
test_imports() {
addTestFile('''
import 'dart:html';
@@ -561,20 +577,6 @@ class B extends A {m() {^}}
assertNoResult('HtmlElement');
});
}
-
- test_import_uri_with_trailing() {
- addFile('/project/bin/testA.dart', 'library libA;');
- addTestFile('''
- import '/project/bin/t^.dart';
- main() {}''');
- return getSuggestions().then((_) {
- expect(replacementOffset, equals(completionOffset - 14));
- expect(replacementLength, equals(5 + 14));
- assertHasResult(
- CompletionSuggestionKind.IMPORT, '/project/bin/testA.dart');
- assertNoResult('test');
- });
- }
}
class MockRelevancySorter implements DartContributionSorter {

Powered by Google App Engine
This is Rietveld 408576698