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

Side by Side Diff: pkg/analyzer/test/src/task/strong_mode_test.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: Created 3 years, 5 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 analyzer.test.src.task.strong_mode_test; 5 library analyzer.test.src.task.strong_mode_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 expect(gatherer.filter, filter); 439 expect(gatherer.filter, filter);
440 } 440 }
441 441
442 test_creation_withoutFilter() async { 442 test_creation_withoutFilter() async {
443 VariableGatherer gatherer = new VariableGatherer(); 443 VariableGatherer gatherer = new VariableGatherer();
444 expect(gatherer, isNotNull); 444 expect(gatherer, isNotNull);
445 expect(gatherer.filter, isNull); 445 expect(gatherer.filter, isNull);
446 } 446 }
447 447
448 test_visit_noReferences() async { 448 test_visit_noReferences() async {
449 Source source = addNamedSource( 449 Source source = addNamedSource('/test.dart', '''
450 '/test.dart',
451 '''
452 library lib; 450 library lib;
453 import 'dart:math'; 451 import 'dart:math';
454 int zero = 0; 452 int zero = 0;
455 class C { 453 class C {
456 void m() => null; 454 void m() => null;
457 } 455 }
458 typedef void F(); 456 typedef void F();
459 '''); 457 ''');
460 var analysisResult = await computeAnalysisResult(source); 458 var analysisResult = await computeAnalysisResult(source);
461 VariableGatherer gatherer = new VariableGatherer(); 459 VariableGatherer gatherer = new VariableGatherer();
462 analysisResult.unit.accept(gatherer); 460 analysisResult.unit.accept(gatherer);
463 expect(gatherer.results, hasLength(0)); 461 expect(gatherer.results, hasLength(0));
464 } 462 }
465 463
466 test_visit_withFilter() async { 464 test_visit_withFilter() async {
467 VariableFilter filter = (VariableElement variable) => variable.isStatic; 465 VariableFilter filter = (VariableElement variable) => variable.isStatic;
468 Set<VariableElement> variables = await _gather(filter); 466 Set<VariableElement> variables = await _gather(filter);
469 expect(variables, hasLength(1)); 467 expect(variables, hasLength(1));
470 } 468 }
471 469
472 test_visit_withoutFilter() async { 470 test_visit_withoutFilter() async {
473 Set<VariableElement> variables = await _gather(); 471 Set<VariableElement> variables = await _gather();
474 expect(variables, hasLength(4)); 472 expect(variables, hasLength(4));
475 } 473 }
476 474
477 Future<Set<VariableElement>> _gather([VariableFilter filter = null]) async { 475 Future<Set<VariableElement>> _gather([VariableFilter filter = null]) async {
478 Source source = addNamedSource( 476 Source source = addNamedSource('/test.dart', '''
479 '/test.dart',
480 '''
481 const int zero = 0; 477 const int zero = 0;
482 class Counter { 478 class Counter {
483 int value = zero; 479 int value = zero;
484 void inc() { 480 void inc() {
485 value++; 481 value++;
486 } 482 }
487 void dec() { 483 void dec() {
488 value = value - 1; 484 value = value - 1;
489 } 485 }
490 void fromZero(f(int index)) { 486 void fromZero(f(int index)) {
491 for (int i = zero; i < value; i++) { 487 for (int i = zero; i < value; i++) {
492 f(i); 488 f(i);
493 } 489 }
494 } 490 }
495 } 491 }
496 '''); 492 ''');
497 var analysisResult = await computeAnalysisResult(source); 493 var analysisResult = await computeAnalysisResult(source);
498 VariableGatherer gatherer = new VariableGatherer(filter); 494 VariableGatherer gatherer = new VariableGatherer(filter);
499 analysisResult.unit.accept(gatherer); 495 analysisResult.unit.accept(gatherer);
500 return gatherer.results; 496 return gatherer.results;
501 } 497 }
502 } 498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698