| OLD | NEW |
| 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 // TODO(jmesserly): this file needs to be refactored, it's a port from | 5 // TODO(jmesserly): this file needs to be refactored, it's a port from |
| 6 // package:dev_compiler's tests | 6 // package:dev_compiler's tests |
| 7 library test.src.task.strong.strong_test_helper; | 7 library test.src.task.strong.strong_test_helper; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 for (var lib in allLibraries) { | 85 for (var lib in allLibraries) { |
| 86 for (var unit in lib.units) { | 86 for (var unit in lib.units) { |
| 87 var errors = <AnalysisError>[]; | 87 var errors = <AnalysisError>[]; |
| 88 collector.errors = errors; | 88 collector.errors = errors; |
| 89 | 89 |
| 90 var source = unit.source; | 90 var source = unit.source; |
| 91 if (source.uri.scheme == 'dart') continue; | 91 if (source.uri.scheme == 'dart') continue; |
| 92 | 92 |
| 93 var librarySource = context.getLibrariesContaining(source).single; | 93 var librarySource = context.getLibrariesContaining(source).single; |
| 94 var resolved = context.resolveCompilationUnit2(source, librarySource); | 94 var resolved = context.resolveCompilationUnit2(source, librarySource); |
| 95 var analyzerErrors = context |
| 96 .getErrors(source) |
| 97 .errors |
| 98 .where((error) => |
| 99 error.errorCode.name.startsWith('dev_compiler.InferredType')) |
| 100 .toList(); |
| 101 errors.addAll(analyzerErrors); |
| 95 checker.visitCompilationUnit(resolved); | 102 checker.visitCompilationUnit(resolved); |
| 96 | 103 |
| 97 new _ExpectedErrorVisitor(errors).validate(resolved); | 104 new _ExpectedErrorVisitor(errors).validate(resolved); |
| 98 } | 105 } |
| 99 } | 106 } |
| 100 }); | 107 }); |
| 101 } | 108 } |
| 102 | 109 |
| 103 class _ErrorCollector implements AnalysisErrorListener { | 110 class _ErrorCollector implements AnalysisErrorListener { |
| 104 List<AnalysisError> errors; | 111 List<AnalysisError> errors; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 String toString(){} | 396 String toString(){} |
| 390 bool ==(other){} | 397 bool ==(other){} |
| 391 } | 398 } |
| 392 class Function {} | 399 class Function {} |
| 393 class StackTrace {} | 400 class StackTrace {} |
| 394 class Symbol {} | 401 class Symbol {} |
| 395 class Type {} | 402 class Type {} |
| 396 | 403 |
| 397 class String { | 404 class String { |
| 398 String operator +(String other) {} | 405 String operator +(String other) {} |
| 406 String substring(int len) {} |
| 399 } | 407 } |
| 400 class bool {} | 408 class bool {} |
| 401 class num { | 409 class num { |
| 402 num operator +(num other) {} | 410 num operator +(num other) {} |
| 403 } | 411 } |
| 404 class int extends num { | 412 class int extends num { |
| 405 bool operator<(num other) {} | 413 bool operator<(num other) {} |
| 406 int operator-() {} | 414 int operator-() {} |
| 407 } | 415 } |
| 408 class double extends num {} | 416 class double extends num {} |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 if (levelName == 'warning') return _MAGENTA_COLOR; | 503 if (levelName == 'warning') return _MAGENTA_COLOR; |
| 496 if (levelName == 'info') return _CYAN_COLOR; | 504 if (levelName == 'info') return _CYAN_COLOR; |
| 497 return null; | 505 return null; |
| 498 } | 506 } |
| 499 | 507 |
| 500 const String _RED_COLOR = '\u001b[31m'; | 508 const String _RED_COLOR = '\u001b[31m'; |
| 501 const String _MAGENTA_COLOR = '\u001b[35m'; | 509 const String _MAGENTA_COLOR = '\u001b[35m'; |
| 502 const String _CYAN_COLOR = '\u001b[36m'; | 510 const String _CYAN_COLOR = '\u001b[36m'; |
| 503 const String GREEN_COLOR = '\u001b[32m'; | 511 const String GREEN_COLOR = '\u001b[32m'; |
| 504 const String NO_COLOR = '\u001b[0m'; | 512 const String NO_COLOR = '\u001b[0m'; |
| OLD | NEW |