| 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 analyzer.test.resource_utils; | 5 library analyzer.test.resource_utils; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 final MemoryResourceProvider _provider; | 71 final MemoryResourceProvider _provider; |
| 72 | 72 |
| 73 TestPathTranslator(this._provider); | 73 TestPathTranslator(this._provider); |
| 74 | 74 |
| 75 Resource getResource(String posixPath) => | 75 Resource getResource(String posixPath) => |
| 76 _provider.getResource(posixToOSPath(posixPath)); | 76 _provider.getResource(posixToOSPath(posixPath)); |
| 77 | 77 |
| 78 File newFile(String posixPath, String content) => | 78 File newFile(String posixPath, String content) => |
| 79 _provider.newFile(posixToOSPath(posixPath), content); | 79 _provider.newFile(posixToOSPath(posixPath), content); |
| 80 | 80 |
| 81 File newFileWithBytes(String posixPath, List<int> bytes) => |
| 82 _provider.newFileWithBytes(posixToOSPath(posixPath), bytes); |
| 83 |
| 81 Folder newFolder(String posixPath) => | 84 Folder newFolder(String posixPath) => |
| 82 _provider.newFolder(posixToOSPath(posixPath)); | 85 _provider.newFolder(posixToOSPath(posixPath)); |
| 83 } | 86 } |
| 84 | 87 |
| 85 /** | 88 /** |
| 86 * A resource provider for testing that asserts that any supplied paths | 89 * A resource provider for testing that asserts that any supplied paths |
| 87 * are appropriate for the OS platform on which the tests are running. | 90 * are appropriate for the OS platform on which the tests are running. |
| 88 */ | 91 */ |
| 89 class TestResourceProvider implements ResourceProvider { | 92 class TestResourceProvider implements ResourceProvider { |
| 90 final ResourceProvider _provider; | 93 final ResourceProvider _provider; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 fail('Expected windows path, but found: $path'); | 130 fail('Expected windows path, but found: $path'); |
| 128 } | 131 } |
| 129 } else { | 132 } else { |
| 130 if (path.contains('\\')) { | 133 if (path.contains('\\')) { |
| 131 fail('Expected posix path, but found: $path'); | 134 fail('Expected posix path, but found: $path'); |
| 132 } | 135 } |
| 133 } | 136 } |
| 134 return path; | 137 return path; |
| 135 } | 138 } |
| 136 } | 139 } |
| OLD | NEW |