| Index: pkg/analyzer/test/file_system/memory_file_system_test.dart
|
| diff --git a/pkg/analyzer/test/file_system/memory_file_system_test.dart b/pkg/analyzer/test/file_system/memory_file_system_test.dart
|
| index d00d2d4a0735f8f6ee5974d690bac71ab867eb5c..87a82bfc09dae33df8bb7cbfe854dd5e46414b60 100644
|
| --- a/pkg/analyzer/test/file_system/memory_file_system_test.dart
|
| +++ b/pkg/analyzer/test/file_system/memory_file_system_test.dart
|
| @@ -123,6 +123,19 @@ class FileTest {
|
| expect(parent.path, equals('/foo/bar'));
|
| }
|
|
|
| + void test_readAsBytesSync_doesNotExist() {
|
| + File file = provider.getResource('/test.bin');
|
| + expect(() {
|
| + file.readAsBytesSync();
|
| + }, throwsA(_isFileSystemException));
|
| + }
|
| +
|
| + void test_readAsBytesSync_exists() {
|
| + List<int> bytes = <int>[1, 2, 3, 4, 5];
|
| + File file = provider.newFileWithBytes('/file.bin', bytes);
|
| + expect(file.readAsBytesSync(), bytes);
|
| + }
|
| +
|
| void test_readAsStringSync_doesNotExist() {
|
| File file = provider.getResource('/test.txt');
|
| expect(() {
|
| @@ -144,6 +157,14 @@ class FileTest {
|
| File file = provider.getResource('/foo/bar/file.txt');
|
| expect(file.toString(), '/foo/bar/file.txt');
|
| }
|
| +
|
| + void test_writeAsBytesSync() {
|
| + File file = provider.newFileWithBytes('/file.bin', <int>[1, 2]);
|
| + expect(file.readAsBytesSync(), <int>[1, 2]);
|
| + // write new bytes
|
| + file.writeAsBytesSync(<int>[10, 20]);
|
| + expect(file.readAsBytesSync(), <int>[10, 20]);
|
| + }
|
| }
|
|
|
| @reflectiveTest
|
| @@ -467,6 +488,16 @@ class MemoryResourceProviderTest {
|
| expect(source.contents.data, equals('contents 2'));
|
| }
|
|
|
| + void test_newFileWithBytes() {
|
| + String path = '/my/file';
|
| + List<int> bytes = <int>[1, 2, 3, 4, 5];
|
| + provider.newFileWithBytes(path, bytes);
|
| + File file = provider.getResource(path);
|
| + expect(file, isNotNull);
|
| + expect(file.exists, isTrue);
|
| + expect(file.readAsBytesSync(), bytes);
|
| + }
|
| +
|
| void test_newFolder_aleadyExists_asFile() {
|
| provider.newFile('/my/file', 'qwerty');
|
| expect(() {
|
|
|