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

Side by Side Diff: pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart

Issue 1266923004: More fixes for failures on the Windows bot (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/completion/import_uri_contributor.d art'; 10 import 'package:analysis_server/src/services/completion/import_uri_contributor.d art';
11 import 'package:path/path.dart'; 11 import 'package:path/path.dart';
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; 12 import 'package:test_reflective_loader/test_reflective_loader.dart';
13 import 'package:unittest/unittest.dart'; 13 import 'package:unittest/unittest.dart';
14 14
15 import '../../utils.dart';
15 import 'completion_test_util.dart'; 16 import 'completion_test_util.dart';
16 17
17 main() { 18 main() {
18 groupSep = ' | '; 19 initializeTestEnvironment();
19 defineReflectiveTests(ImportUriContributorTest); 20 defineReflectiveTests(ImportUriContributorTest);
20 } 21 }
21 22
22 @reflectiveTest 23 @reflectiveTest
23 class ImportUriContributorTest extends AbstractCompletionTest { 24 class ImportUriContributorTest extends AbstractCompletionTest {
24 @override 25 @override
25 void setUpContributor() { 26 void setUpContributor() {
26 contributor = new ImportUriContributor(); 27 contributor = new ImportUriContributor();
27 } 28 }
28 29
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 addSource('/proj/foo/bar.dart', 'library bar;'); 106 addSource('/proj/foo/bar.dart', 'library bar;');
106 addSource('/blat.dart', 'library blat;'); 107 addSource('/blat.dart', 'library blat;');
107 addTestSource('import "foo/^" import'); 108 addTestSource('import "foo/^" import');
108 computeFast(); 109 computeFast();
109 expect(request.replacementOffset, completionOffset - 4); 110 expect(request.replacementOffset, completionOffset - 4);
110 expect(request.replacementLength, 4); 111 expect(request.replacementLength, 4);
111 assertNotSuggested('completion.dart'); 112 assertNotSuggested('completion.dart');
112 assertNotSuggested('other.dart'); 113 assertNotSuggested('other.dart');
113 assertNotSuggested('foo'); 114 assertNotSuggested('foo');
114 assertNotSuggested('foo${separator}'); 115 assertNotSuggested('foo${separator}');
115 assertSuggest('foo${separator}bar.dart', csKind: CompletionSuggestionKind.IM PORT); 116 assertSuggest('foo${separator}bar.dart',
117 csKind: CompletionSuggestionKind.IMPORT);
116 assertNotSuggested('..${separator}blat.dart'); 118 assertNotSuggested('..${separator}blat.dart');
117 } 119 }
118 120
119 test_import_file_parent() { 121 test_import_file_parent() {
120 // TODO(danrubel) fix file uri suggestions on Windows 122 // TODO(danrubel) fix file uri suggestions on Windows
121 if (Platform.isWindows) return; 123 if (Platform.isWindows) return;
122 testFile = '/proj/completion.dart'; 124 testFile = '/proj/completion.dart';
123 addSource('/proj/other.dart', 'library other;'); 125 addSource('/proj/other.dart', 'library other;');
124 addSource('/proj/foo/bar.dart', 'library bar;'); 126 addSource('/proj/foo/bar.dart', 'library bar;');
125 addSource('/blat.dart', 'library blat;'); 127 addSource('/blat.dart', 'library blat;');
126 addTestSource('import "../^" import'); 128 addTestSource('import "../^" import');
127 computeFast(); 129 computeFast();
128 expect(request.replacementOffset, completionOffset - 3); 130 expect(request.replacementOffset, completionOffset - 3);
129 expect(request.replacementLength, 3); 131 expect(request.replacementLength, 3);
130 assertNotSuggested('completion.dart'); 132 assertNotSuggested('completion.dart');
131 assertNotSuggested('other.dart'); 133 assertNotSuggested('other.dart');
132 assertNotSuggested('foo'); 134 assertNotSuggested('foo');
133 assertNotSuggested('foo${separator}'); 135 assertNotSuggested('foo${separator}');
134 assertNotSuggested('foo${separator}bar.dart'); 136 assertNotSuggested('foo${separator}bar.dart');
135 assertSuggest('..${separator}blat.dart', csKind: CompletionSuggestionKind.IM PORT); 137 assertSuggest('..${separator}blat.dart',
138 csKind: CompletionSuggestionKind.IMPORT);
136 } 139 }
137 140
138 test_import_package() { 141 test_import_package() {
139 addPackageSource('foo', 'foo.dart', 'library foo;'); 142 addPackageSource('foo', 'foo.dart', 'library foo;');
140 addPackageSource('foo', 'baz/too.dart', 'library too;'); 143 addPackageSource('foo', 'baz/too.dart', 'library too;');
141 addPackageSource('bar', 'bar.dart', 'library bar;'); 144 addPackageSource('bar', 'bar.dart', 'library bar;');
142 addTestSource('import "p^" import'); 145 addTestSource('import "p^" import');
143 computeFast(); 146 computeFast();
144 expect(request.replacementOffset, completionOffset - 1); 147 expect(request.replacementOffset, completionOffset - 1);
145 expect(request.replacementLength, 1); 148 expect(request.replacementLength, 1);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 addSource('/proj/foo/bar.dart', 'library bar;'); 241 addSource('/proj/foo/bar.dart', 'library bar;');
239 addSource('/blat.dart', 'library blat;'); 242 addSource('/blat.dart', 'library blat;');
240 addTestSource('library x; part "foo/^" import'); 243 addTestSource('library x; part "foo/^" import');
241 computeFast(); 244 computeFast();
242 expect(request.replacementOffset, completionOffset - 4); 245 expect(request.replacementOffset, completionOffset - 4);
243 expect(request.replacementLength, 4); 246 expect(request.replacementLength, 4);
244 assertNotSuggested('completion.dart'); 247 assertNotSuggested('completion.dart');
245 assertNotSuggested('other.dart'); 248 assertNotSuggested('other.dart');
246 assertNotSuggested('foo'); 249 assertNotSuggested('foo');
247 assertNotSuggested('foo${separator}'); 250 assertNotSuggested('foo${separator}');
248 assertSuggest('foo${separator}bar.dart', csKind: CompletionSuggestionKind.IM PORT); 251 assertSuggest('foo${separator}bar.dart',
252 csKind: CompletionSuggestionKind.IMPORT);
249 assertNotSuggested('..${separator}blat.dart'); 253 assertNotSuggested('..${separator}blat.dart');
250 } 254 }
251 255
252 test_part_file_parent() { 256 test_part_file_parent() {
253 // TODO(danrubel) fix file uri suggestions on Windows 257 // TODO(danrubel) fix file uri suggestions on Windows
254 if (Platform.isWindows) return; 258 if (Platform.isWindows) return;
255 testFile = '/proj/completion.dart'; 259 testFile = '/proj/completion.dart';
256 addSource('/proj/other.dart', 'library other;'); 260 addSource('/proj/other.dart', 'library other;');
257 addSource('/proj/foo/bar.dart', 'library bar;'); 261 addSource('/proj/foo/bar.dart', 'library bar;');
258 addSource('/blat.dart', 'library blat;'); 262 addSource('/blat.dart', 'library blat;');
259 addTestSource('library x; part "../^" import'); 263 addTestSource('library x; part "../^" import');
260 computeFast(); 264 computeFast();
261 expect(request.replacementOffset, completionOffset - 3); 265 expect(request.replacementOffset, completionOffset - 3);
262 expect(request.replacementLength, 3); 266 expect(request.replacementLength, 3);
263 assertNotSuggested('completion.dart'); 267 assertNotSuggested('completion.dart');
264 assertNotSuggested('other.dart'); 268 assertNotSuggested('other.dart');
265 assertNotSuggested('foo'); 269 assertNotSuggested('foo');
266 assertNotSuggested('foo${separator}'); 270 assertNotSuggested('foo${separator}');
267 assertNotSuggested('foo${separator}bar.dart'); 271 assertNotSuggested('foo${separator}bar.dart');
268 assertSuggest('..${separator}blat.dart', csKind: CompletionSuggestionKind.IM PORT); 272 assertSuggest('..${separator}blat.dart',
273 csKind: CompletionSuggestionKind.IMPORT);
269 } 274 }
270 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698