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

Side by Side Diff: pkg/front_end/test/src/incremental/file_state_test.dart

Issue 2928393004: Add FileState.hasMixin/hasMixinLibrary properties. (Closed)
Patch Set: Tweaks for review comments. Created 3 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
« no previous file with comments | « pkg/front_end/lib/src/incremental/file_state.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/memory_file_system.dart'; 7 import 'package:front_end/memory_file_system.dart';
8 import 'package:front_end/src/fasta/translate_uri.dart'; 8 import 'package:front_end/src/fasta/translate_uri.dart';
9 import 'package:front_end/src/incremental/file_state.dart'; 9 import 'package:front_end/src/incremental/file_state.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 expect(export_.combinators[1].names, unorderedEquals(['C'])); 277 expect(export_.combinators[1].names, unorderedEquals(['C']));
278 expect(export_.combinators[2].isShow, isTrue); 278 expect(export_.combinators[2].isShow, isTrue);
279 expect(export_.combinators[2].names, unorderedEquals(['A', 'D'])); 279 expect(export_.combinators[2].names, unorderedEquals(['A', 'D']));
280 expect(export_.isExposed('A'), isTrue); 280 expect(export_.isExposed('A'), isTrue);
281 expect(export_.isExposed('B'), isFalse); 281 expect(export_.isExposed('B'), isFalse);
282 expect(export_.isExposed('C'), isFalse); 282 expect(export_.isExposed('C'), isFalse);
283 expect(export_.isExposed('D'), isTrue); 283 expect(export_.isExposed('D'), isTrue);
284 } 284 }
285 } 285 }
286 286
287 test_hasMixinApplication_false() async {
288 writeFile(
289 '/a.dart',
290 r'''
291 class A {}
292 class B extends Object with A {}
293 ''');
294 var uri = writeFile(
295 '/test.dart',
296 r'''
297 import 'a.dart';
298 class T1 extends A {}
299 class T2 extends B {}
300 ''');
301 FileState file = await fsState.getFile(uri);
302 expect(file.hasMixinApplication, isFalse);
303 }
304
305 test_hasMixinApplication_true_class() async {
306 var uri = writeFile(
307 '/test.dart',
308 r'''
309 class A {}
310 class B extends Object with A {}
311 ''');
312 FileState file = await fsState.getFile(uri);
313 expect(file.hasMixinApplication, isTrue);
314 }
315
316 test_hasMixinApplication_true_named() async {
317 var uri = writeFile(
318 '/test.dart',
319 r'''
320 class A {}
321 class B = Object with A;
322 ''');
323 FileState file = await fsState.getFile(uri);
324 expect(file.hasMixinApplication, isTrue);
325 }
326
327 test_hasMixinApplicationLibrary_false() async {
328 var partUri = writeFile(
329 '/part.dart',
330 r'''
331 part of test;
332 class A {}
333 ''');
334 var libUri = writeFile(
335 '/test.dart',
336 r'''
337 library test;
338 part 'part.dart';
339 class B extends A {}
340 ''');
341
342 FileState part = await fsState.getFile(partUri);
343 FileState lib = await fsState.getFile(libUri);
344
345 expect(part.hasMixinApplication, isFalse);
346 expect(lib.hasMixinApplication, isFalse);
347 expect(lib.hasMixinApplicationLibrary, isFalse);
348 }
349
350 test_hasMixinApplicationLibrary_true_inDefiningUnit() async {
351 var partUri = writeFile(
352 '/part.dart',
353 r'''
354 part of test;
355 class A {}
356 ''');
357 var libUri = writeFile(
358 '/test.dart',
359 r'''
360 library test;
361 part 'part.dart';
362 class B extends Object with A {}
363 ''');
364
365 FileState part = await fsState.getFile(partUri);
366 FileState lib = await fsState.getFile(libUri);
367
368 expect(part.hasMixinApplication, isFalse);
369 expect(lib.hasMixinApplication, isTrue);
370 expect(lib.hasMixinApplicationLibrary, isTrue);
371 }
372
373 test_hasMixinApplicationLibrary_true_inPart() async {
374 var partUri = writeFile(
375 '/part.dart',
376 r'''
377 part of test;
378 class A {}
379 class B extends Object with A {}
380 ''');
381 var libUri = writeFile(
382 '/test.dart',
383 r'''
384 library test;
385 part 'part.dart';
386 class C {}
387 ''');
388
389 FileState part = await fsState.getFile(partUri);
390 FileState lib = await fsState.getFile(libUri);
391
392 expect(part.hasMixinApplication, isTrue);
393 expect(lib.hasMixinApplication, isFalse);
394 expect(lib.hasMixinApplicationLibrary, isTrue);
395 }
396
287 test_newFileListener() async { 397 test_newFileListener() async {
288 var a = writeFile('/a.dart', ''); 398 var a = writeFile('/a.dart', '');
289 var b = writeFile('/b.dart', ''); 399 var b = writeFile('/b.dart', '');
290 var c = writeFile( 400 var c = writeFile(
291 '/c.dart', 401 '/c.dart',
292 r''' 402 r'''
293 import 'a.dart'; 403 import 'a.dart';
294 '''); 404 ''');
295 405
296 FileState cFile = await fsState.getFile(c); 406 FileState cFile = await fsState.getFile(c);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 Uri _writeFileDirectives(String path, 501 Uri _writeFileDirectives(String path,
392 {List<String> imports: const [], List<String> exports: const []}) { 502 {List<String> imports: const [], List<String> exports: const []}) {
393 return writeFile( 503 return writeFile(
394 path, 504 path,
395 ''' 505 '''
396 ${imports.map((uri) => 'import "$uri";').join('\n')} 506 ${imports.map((uri) => 'import "$uri";').join('\n')}
397 ${exports.map((uri) => 'export "$uri";').join('\n')} 507 ${exports.map((uri) => 'export "$uri";').join('\n')}
398 '''); 508 ''');
399 } 509 }
400 } 510 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/incremental/file_state.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698