Chromium Code Reviews| 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 library dev_compiler.src.testing; | 5 library dev_compiler.src.testing; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 import 'package:analyzer/file_system/file_system.dart'; | 8 import 'package:analyzer/file_system/file_system.dart'; |
| 9 import 'package:analyzer/file_system/memory_file_system.dart'; | 9 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 ErrorSeverity.ERROR: Level.SEVERE, | 198 ErrorSeverity.ERROR: Level.SEVERE, |
| 199 ErrorSeverity.WARNING: Level.WARNING, | 199 ErrorSeverity.WARNING: Level.WARNING, |
| 200 ErrorSeverity.INFO: Level.INFO | 200 ErrorSeverity.INFO: Level.INFO |
| 201 }[actual.errorCode.errorSeverity]; | 201 }[actual.errorCode.errorSeverity]; |
| 202 } | 202 } |
| 203 | 203 |
| 204 String _formatActualError(AnalysisError actual) { | 204 String _formatActualError(AnalysisError actual) { |
| 205 var span = _createSpan(actual.offset, actual.length); | 205 var span = _createSpan(actual.offset, actual.length); |
| 206 var levelName = _actualErrorLevel(actual).name.toLowerCase(); | 206 var levelName = _actualErrorLevel(actual).name.toLowerCase(); |
| 207 var msg = span.message(actual.message, color: colorOf(levelName)); | 207 var msg = span.message(actual.message, color: colorOf(levelName)); |
| 208 return '$levelName: $msg'; | 208 return '$levelName: [${actual.errorCode.name}] $msg'; |
|
Jennifer Messerly
2015/07/09 17:03:29
makes it easier to debug
| |
| 209 } | 209 } |
| 210 | 210 |
| 211 SourceSpan _createSpan(int offset, int len) { | 211 SourceSpan _createSpan(int offset, int len) { |
| 212 return createSpanHelper( | 212 return createSpanHelper( |
| 213 _unit, offset, offset + len, _unit.element.source, _unitSourceCode); | 213 _unit, offset, offset + len, _unit.element.source, _unitSourceCode); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 /// Describes an expected message that should be produced by the checker. | 217 /// Describes an expected message that should be produced by the checker. |
| 218 class _ErrorExpectation { | 218 class _ErrorExpectation { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 243 expect(tokens[1], "should", reason: 'invalid error descriptor'); | 243 expect(tokens[1], "should", reason: 'invalid error descriptor'); |
| 244 expect(tokens[2], "be", reason: 'invalid error descriptor'); | 244 expect(tokens[2], "be", reason: 'invalid error descriptor'); |
| 245 if (tokens[0] == "pass") return null; | 245 if (tokens[0] == "pass") return null; |
| 246 // TODO(leafp) For now, we just use whatever the current expectation is, | 246 // TODO(leafp) For now, we just use whatever the current expectation is, |
| 247 // eventually we could do more automated reporting here. | 247 // eventually we could do more automated reporting here. |
| 248 return _parse(tokens[0]); | 248 return _parse(tokens[0]); |
| 249 } | 249 } |
| 250 | 250 |
| 251 String toString() => '$level $typeName'; | 251 String toString() => '$level $typeName'; |
| 252 } | 252 } |
| OLD | NEW |