| 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 ddc.src.testing; | 5 library ddc.src.testing; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 9 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| 11 import 'package:logging/logging.dart'; | 11 import 'package:logging/logging.dart'; |
| 12 import 'package:path/path.dart' as path; | 12 import 'package:path/path.dart' as path; |
| 13 import 'package:source_span/source_span.dart'; | 13 import 'package:source_span/source_span.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
| 15 | 15 |
| 16 import 'package:ddc/src/checker/dart_sdk.dart' | 16 import 'package:dev_compiler/src/checker/dart_sdk.dart' |
| 17 show mockSdkSources, dartSdkDirectory; | 17 show mockSdkSources, dartSdkDirectory; |
| 18 import 'package:ddc/src/checker/resolver.dart' show TypeResolver; | 18 import 'package:dev_compiler/src/checker/resolver.dart' show TypeResolver; |
| 19 import 'package:ddc/src/utils.dart'; | 19 import 'package:dev_compiler/src/utils.dart'; |
| 20 import 'package:ddc/src/info.dart'; | 20 import 'package:dev_compiler/src/info.dart'; |
| 21 import 'package:ddc/src/options.dart'; | 21 import 'package:dev_compiler/src/options.dart'; |
| 22 import 'package:ddc/src/report.dart'; | 22 import 'package:dev_compiler/src/report.dart'; |
| 23 import 'package:ddc/devc.dart' show compile; | 23 import 'package:dev_compiler/devc.dart' show compile; |
| 24 | 24 |
| 25 /// Run the checker on a program with files contents as indicated in | 25 /// Run the checker on a program with files contents as indicated in |
| 26 /// [testFiles]. | 26 /// [testFiles]. |
| 27 /// | 27 /// |
| 28 /// This function makes several assumptions to make it easier to describe error | 28 /// This function makes several assumptions to make it easier to describe error |
| 29 /// expectations: | 29 /// expectations: |
| 30 /// | 30 /// |
| 31 /// * a file named `/main.dart` exists in [testFiles]. | 31 /// * a file named `/main.dart` exists in [testFiles]. |
| 32 /// * all expected failures are listed in the source code using comments | 32 /// * all expected failures are listed in the source code using comments |
| 33 /// immediately in front of the AST node that should contain the error. | 33 /// immediately in front of the AST node that should contain the error. |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 SourceSpan spanFor(AstNode node) { | 303 SourceSpan spanFor(AstNode node) { |
| 304 final begin = node is AnnotatedNode | 304 final begin = node is AnnotatedNode |
| 305 ? node.firstTokenAfterCommentAndMetadata.offset | 305 ? node.firstTokenAfterCommentAndMetadata.offset |
| 306 : node.offset; | 306 : node.offset; |
| 307 return _file.span(begin, node.end); | 307 return _file.span(begin, node.end); |
| 308 } | 308 } |
| 309 | 309 |
| 310 String toString() => '[$runtimeType: $uri]'; | 310 String toString() => '[$runtimeType: $uri]'; |
| 311 } | 311 } |
| OLD | NEW |