| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 var errorInfo = checker.computeErrors(unit.source); | 87 var errorInfo = checker.computeErrors(unit.source); |
| 88 new _ExpectedErrorVisitor(errorInfo.errors).validate(unit.unit); | 88 new _ExpectedErrorVisitor(errorInfo.errors).validate(unit.unit); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 /// Creates a [MemoryResourceProvider] with test data | 93 /// Creates a [MemoryResourceProvider] with test data |
| 94 MemoryResourceProvider createTestResourceProvider( | 94 MemoryResourceProvider createTestResourceProvider( |
| 95 Map<String, String> testFiles) { | 95 Map<String, String> testFiles) { |
| 96 var provider = new MemoryResourceProvider(); | 96 var provider = new MemoryResourceProvider(); |
| 97 runtimeFilesForServerMode.forEach((filepath) { | 97 runtimeFilesForServerMode().forEach((filepath) { |
| 98 testFiles['/dev_compiler_runtime/$filepath'] = | 98 testFiles['/dev_compiler_runtime/$filepath'] = |
| 99 '/* test contents of $filepath */'; | 99 '/* test contents of $filepath */'; |
| 100 }); | 100 }); |
| 101 testFiles.forEach((key, value) { | 101 testFiles.forEach((key, value) { |
| 102 var scheme = 'package:'; | 102 var scheme = 'package:'; |
| 103 if (key.startsWith(scheme)) { | 103 if (key.startsWith(scheme)) { |
| 104 key = '/packages/${key.substring(scheme.length)}'; | 104 key = '/packages/${key.substring(scheme.length)}'; |
| 105 } | 105 } |
| 106 provider.newFile(key, value); | 106 provider.newFile(key, value); |
| 107 }); | 107 }); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |