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

Side by Side Diff: pkg/analysis_server/test/resource_test.dart

Issue 300023004: Partial implementation of the 'setAnalysisRoots' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/mocks.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.resource; 5 library test.resource;
6 6
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import 'package:analysis_server/src/resource.dart'; 9 import 'package:analysis_server/src/resource.dart';
10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 group('_MemoryFileSource', () { 128 group('_MemoryFileSource', () {
129 Source source; 129 Source source;
130 130
131 group('existent', () { 131 group('existent', () {
132 setUp(() { 132 setUp(() {
133 File file = provider.newFile('/foo/test.dart', 'library test;'); 133 File file = provider.newFile('/foo/test.dart', 'library test;');
134 source = file.createSource(UriKind.FILE_URI); 134 source = file.createSource(UriKind.FILE_URI);
135 }); 135 });
136 136
137 group('==', () {
138 group('true', () {
139 test('self', () {
140 File file = provider.newFile('/foo/test.dart', '');
141 Source source = file.createSource(UriKind.FILE_URI);
142 expect(source == source, isTrue);
143 });
144
145 test('same file', () {
146 File file = provider.newFile('/foo/test.dart', '');
147 Source sourceA = file.createSource(UriKind.FILE_URI);
148 Source sourceB = file.createSource(UriKind.FILE_URI);
149 expect(sourceA == sourceB, isTrue);
150 });
151 });
152
153 group('false', () {
154 test('not a memory Source', () {
155 File file = provider.newFile('/foo/test.dart', '');
156 Source source = file.createSource(UriKind.FILE_URI);
157 expect(source == new Object(), isFalse);
158 });
159
160 test('different file', () {
161 File fileA = provider.newFile('/foo/a.dart', '');
162 File fileB = provider.newFile('/foo/b.dart', '');
163 Source sourceA = fileA.createSource(UriKind.FILE_URI);
164 Source sourceB = fileB.createSource(UriKind.FILE_URI);
165 expect(sourceA == sourceB, isFalse);
166 });
167 });
168 });
169
137 test('contents', () { 170 test('contents', () {
138 TimestampedData<String> contents = source.contents; 171 TimestampedData<String> contents = source.contents;
139 expect(contents.data, 'library test;'); 172 expect(contents.data, 'library test;');
140 }); 173 });
141 174
142 test('encoding', () { 175 test('encoding', () {
143 expect(source.encoding, 'f/foo/test.dart'); 176 expect(source.encoding, 'f/foo/test.dart');
144 }); 177 });
145 178
146 test('exists', () { 179 test('exists', () {
147 expect(source.exists(), isTrue); 180 expect(source.exists(), isTrue);
148 }); 181 });
149 182
150 test('fullName', () { 183 test('fullName', () {
151 expect(source.fullName, '/foo/test.dart'); 184 expect(source.fullName, '/foo/test.dart');
152 }); 185 });
153 186
187 test('hashCode', () {
188 source.hashCode;
189 });
190
154 test('shortName', () { 191 test('shortName', () {
155 expect(source.shortName, 'test.dart'); 192 expect(source.shortName, 'test.dart');
156 }); 193 });
157 194
158 test('resolveRelative', () { 195 test('resolveRelative', () {
159 var relative = source.resolveRelative(new Uri.file('bar/baz.dart')); 196 var relative = source.resolveRelative(new Uri.file('bar/baz.dart'));
160 expect(relative.fullName, '/foo/bar/baz.dart'); 197 expect(relative.fullName, '/foo/bar/baz.dart');
161 }); 198 });
162 }); 199 });
163 200
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 expect(children[1], _isFolder); 349 expect(children[1], _isFolder);
313 expect(children[2], _isFile); 350 expect(children[2], _isFile);
314 }); 351 });
315 }); 352 });
316 }); 353 });
317 } 354 }
318 355
319 var _isFile = new isInstanceOf<File>(); 356 var _isFile = new isInstanceOf<File>();
320 var _isFolder = new isInstanceOf<Folder>(); 357 var _isFolder = new isInstanceOf<Folder>();
321 var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>(); 358 var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>();
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/mocks.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698