| Index: pkg/front_end/test/memory_file_system_test.dart
|
| diff --git a/pkg/front_end/test/memory_file_system_test.dart b/pkg/front_end/test/memory_file_system_test.dart
|
| index 1f7d6c3f9c4c439ef545cf4849f5cfdcbc6ed7f6..139fd7082f37d8b994e6dd7c912774f5bd7f597f 100644
|
| --- a/pkg/front_end/test/memory_file_system_test.dart
|
| +++ b/pkg/front_end/test/memory_file_system_test.dart
|
| @@ -8,6 +8,7 @@ library front_end.test.memory_file_system_test;
|
| import 'dart:convert';
|
| import 'dart:io' as io;
|
|
|
| +import 'package:front_end/file_system.dart' show FileSystemException;
|
| import 'package:front_end/memory_file_system.dart';
|
| import 'package:path/path.dart' as pathos;
|
| import 'package:test/test.dart';
|
| @@ -22,6 +23,9 @@ main() {
|
| });
|
| }
|
|
|
| +const Matcher _throwsFileSystemException =
|
| + const Throws(const isInstanceOf<FileSystemException>());
|
| +
|
| @reflectiveTest
|
| class FileTest extends _BaseTestNative {
|
| String path;
|
| @@ -41,10 +45,36 @@ class FileTest extends _BaseTestNative {
|
| expect(file == entityForPath(join(tempPath, 'file.txt')), isTrue);
|
| }
|
|
|
| + test_exists_doesNotExist() async {
|
| + expect(await file.exists(), false);
|
| + }
|
| +
|
| + test_exists_exists() async {
|
| + file.writeAsStringSync('x');
|
| + expect(await file.exists(), true);
|
| + }
|
| +
|
| test_hashCode_samePath() {
|
| expect(file.hashCode, entityForPath(join(tempPath, 'file.txt')).hashCode);
|
| }
|
|
|
| + test_lastModified_doesNotExist() async {
|
| + expect(file.lastModified(), _throwsFileSystemException);
|
| + }
|
| +
|
| + test_lastModified_increasesOnEachChange() async {
|
| + file.writeAsStringSync('x');
|
| + var mod1 = await file.lastModified();
|
| + file.writeAsStringSync('y');
|
| + var mod2 = await file.lastModified();
|
| + expect(mod2.isAfter(mod1), isTrue);
|
| +
|
| + var file2 = entityForPath(join(tempPath, 'file2.txt'));
|
| + file2.writeAsStringSync('z');
|
| + var mod3 = await file2.lastModified();
|
| + expect(mod3.isAfter(mod2), isTrue);
|
| + }
|
| +
|
| test_path() {
|
| expect(file.uri, context.toUri(path));
|
| }
|
| @@ -57,7 +87,7 @@ class FileTest extends _BaseTestNative {
|
| }
|
|
|
| test_readAsBytes_doesNotExist() {
|
| - expect(file.readAsBytes(), throwsException);
|
| + expect(file.readAsBytes(), _throwsFileSystemException);
|
| }
|
|
|
| test_readAsBytes_exists() async {
|
| @@ -68,11 +98,11 @@ class FileTest extends _BaseTestNative {
|
|
|
| test_readAsString_badUtf8() {
|
| file.writeAsBytesSync([0xc0, 0x40]); // Invalid UTF-8
|
| - expect(file.readAsString(), throwsException);
|
| + expect(file.readAsString(), _throwsFileSystemException);
|
| }
|
|
|
| test_readAsString_doesNotExist() {
|
| - expect(file.readAsString(), throwsException);
|
| + expect(file.readAsString(), _throwsFileSystemException);
|
| }
|
|
|
| test_readAsString_exists() async {
|
| @@ -86,32 +116,6 @@ class FileTest extends _BaseTestNative {
|
| expect(await file.readAsString(), '\u20ac');
|
| }
|
|
|
| - test_exists_doesNotExist() async {
|
| - expect(await file.exists(), false);
|
| - }
|
| -
|
| - test_exists_exists() async {
|
| - file.writeAsStringSync('x');
|
| - expect(await file.exists(), true);
|
| - }
|
| -
|
| - test_lastModified_doesNotExist() async {
|
| - expect(file.lastModified(), throwsException);
|
| - }
|
| -
|
| - test_lastModified_increasesOnEachChange() async {
|
| - file.writeAsStringSync('x');
|
| - var mod1 = await file.lastModified();
|
| - file.writeAsStringSync('y');
|
| - var mod2 = await file.lastModified();
|
| - expect(mod2.isAfter(mod1), isTrue);
|
| -
|
| - var file2 = entityForPath(join(tempPath, 'file2.txt'));
|
| - file2.writeAsStringSync('z');
|
| - var mod3 = await file2.lastModified();
|
| - expect(mod3.isAfter(mod2), isTrue);
|
| - }
|
| -
|
| test_writeAsBytesSync_modifyAfterRead() async {
|
| file.writeAsBytesSync([1]);
|
| (await file.readAsBytes())[0] = 2;
|
|
|