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

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/uri_contributor_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.completion.contributor.dart.importuri; 5 library test.services.completion.contributor.dart.importuri;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; 7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
9 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar t'; 9 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar t';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 10 import 'package:analyzer/file_system/memory_file_system.dart';
11 import 'package:path/path.dart'; 11 import 'package:path/path.dart';
12 import 'package:test/test.dart';
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; 13 import 'package:test_reflective_loader/test_reflective_loader.dart';
13 import 'package:unittest/unittest.dart';
14 14
15 import '../../../utils.dart'; 15 import '../../../utils.dart';
16 import 'completion_contributor_util.dart'; 16 import 'completion_contributor_util.dart';
17 17
18 main() { 18 main() {
19 initializeTestEnvironment(); 19 initializeTestEnvironment();
20 defineReflectiveTests(UriContributorTest); 20 defineReflectiveSuite(() {
21 defineReflectiveTests(UriContributorWindowsTest); 21 defineReflectiveTests(UriContributorTest);
22 defineReflectiveTests(UriContributorWindowsTest);
23 });
22 } 24 }
23 25
24 @reflectiveTest 26 @reflectiveTest
25 class UriContributorTest extends DartCompletionContributorTest { 27 class UriContributorTest extends DartCompletionContributorTest {
26 @override 28 @override
27 DartCompletionContributor createContributor() { 29 DartCompletionContributor createContributor() {
28 return new UriContributor(); 30 return new UriContributor();
29 } 31 }
30 32
31 test_after_import() async { 33 test_after_import() async {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 test_import_package2() async { 262 test_import_package2() async {
261 addPackageSource('foo', 'foo.dart', 'library foo;'); 263 addPackageSource('foo', 'foo.dart', 'library foo;');
262 addPackageSource('foo', 'baz/too.dart', 'library too;'); 264 addPackageSource('foo', 'baz/too.dart', 'library too;');
263 addPackageSource('bar', 'bar.dart', 'library bar;'); 265 addPackageSource('bar', 'bar.dart', 'library bar;');
264 addTestSource('import "package:foo/baz/^" import'); 266 addTestSource('import "package:foo/baz/^" import');
265 await computeSuggestions(); 267 await computeSuggestions();
266 assertSuggest('package:foo/baz/too.dart', 268 assertSuggest('package:foo/baz/too.dart',
267 csKind: CompletionSuggestionKind.IMPORT); 269 csKind: CompletionSuggestionKind.IMPORT);
268 } 270 }
269 271
272 test_import_package2_raw() async {
273 addPackageSource('foo', 'foo.dart', 'library foo;');
274 addPackageSource('foo', 'baz/too.dart', 'library too;');
275 addPackageSource('bar', 'bar.dart', 'library bar;');
276 addTestSource('import r"package:foo/baz/^" import');
277 await computeSuggestions();
278 assertSuggest('package:foo/baz/too.dart',
279 csKind: CompletionSuggestionKind.IMPORT);
280 }
281
270 test_import_package2_with_trailing() async { 282 test_import_package2_with_trailing() async {
271 addPackageSource('foo', 'foo.dart', 'library foo;'); 283 addPackageSource('foo', 'foo.dart', 'library foo;');
272 addPackageSource('foo', 'baz/too.dart', 'library too;'); 284 addPackageSource('foo', 'baz/too.dart', 'library too;');
273 addPackageSource('bar', 'bar.dart', 'library bar;'); 285 addPackageSource('bar', 'bar.dart', 'library bar;');
274 addTestSource('import "package:foo/baz/^.dart" import'); 286 addTestSource('import "package:foo/baz/^.dart" import');
275 await computeSuggestions(); 287 await computeSuggestions();
276 assertSuggest('package:foo/baz/too.dart', 288 assertSuggest('package:foo/baz/too.dart',
277 csKind: CompletionSuggestionKind.IMPORT); 289 csKind: CompletionSuggestionKind.IMPORT);
278 expect(replacementOffset, completionOffset - 16); 290 expect(replacementOffset, completionOffset - 16);
279 expect(replacementLength, 5 + 16); 291 expect(replacementLength, 5 + 16);
280 } 292 }
281 293
282 test_import_package2_raw() async {
283 addPackageSource('foo', 'foo.dart', 'library foo;');
284 addPackageSource('foo', 'baz/too.dart', 'library too;');
285 addPackageSource('bar', 'bar.dart', 'library bar;');
286 addTestSource('import r"package:foo/baz/^" import');
287 await computeSuggestions();
288 assertSuggest('package:foo/baz/too.dart',
289 csKind: CompletionSuggestionKind.IMPORT);
290 }
291
292 test_import_package_missing_lib() async { 294 test_import_package_missing_lib() async {
293 var pkgSrc = addPackageSource('bar', 'bar.dart', 'library bar;'); 295 var pkgSrc = addPackageSource('bar', 'bar.dart', 'library bar;');
294 provider.deleteFolder(dirname(pkgSrc.fullName)); 296 provider.deleteFolder(dirname(pkgSrc.fullName));
295 addTestSource('import "p^" class'); 297 addTestSource('import "p^" class');
296 await computeSuggestions(); 298 await computeSuggestions();
297 expect(replacementOffset, completionOffset - 1); 299 expect(replacementOffset, completionOffset - 1);
298 expect(replacementLength, 1); 300 expect(replacementLength, 1);
299 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT); 301 assertSuggest('package:', csKind: CompletionSuggestionKind.IMPORT);
300 assertSuggest('package:bar/', csKind: CompletionSuggestionKind.IMPORT); 302 assertSuggest('package:bar/', csKind: CompletionSuggestionKind.IMPORT);
301 assertNotSuggested('package:bar/bar.dart'); 303 assertNotSuggested('package:bar/bar.dart');
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 assertNotSuggested('foo/'); 627 assertNotSuggested('foo/');
626 assertNotSuggested('foo/bar.dart'); 628 assertNotSuggested('foo/bar.dart');
627 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); 629 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT);
628 } 630 }
629 } 631 }
630 632
631 class _TestWinResourceProvider extends MemoryResourceProvider { 633 class _TestWinResourceProvider extends MemoryResourceProvider {
632 @override 634 @override
633 Context get pathContext => windows; 635 Context get pathContext => windows;
634 } 636 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698