Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: pkg/front_end/test/memory_file_system_test.dart

Issue 2994643002: Add createDirectory() to MemoryFileSystemEntity. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/memory_file_system.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f0b44533d9816c1e308ea980ad39ed91a390e36f..986abb70fe139a55df95d8e5543ea97d138ff60d 100644
--- a/pkg/front_end/test/memory_file_system_test.dart
+++ b/pkg/front_end/test/memory_file_system_test.dart
@@ -37,6 +37,21 @@ class FileTest extends _BaseTestNative {
file = entityForPath(path);
}
+ test_createDirectory_doesNotExist() async {
+ file.createDirectory();
+ expect(await file.exists(), true);
+ }
+
+ test_createDirectory_exists_asDirectory() async {
+ file.createDirectory();
+ expect(() => file.createDirectory(), _throwsFileSystemException);
+ }
+
+ test_createDirectory_exists_asFile() async {
+ file.writeAsStringSync('');
+ expect(() => file.createDirectory(), _throwsFileSystemException);
+ }
+
test_equals_differentPaths() {
expect(file == entityForPath(join(tempPath, 'file2.txt')), isFalse);
}
@@ -45,11 +60,16 @@ class FileTest extends _BaseTestNative {
expect(file == entityForPath(join(tempPath, 'file.txt')), isTrue);
}
+ test_exists_directory_exists() async {
+ file.createDirectory();
+ expect(await file.exists(), true);
+ }
+
test_exists_doesNotExist() async {
expect(await file.exists(), false);
}
- test_exists_exists() async {
+ test_exists_file_exists() async {
file.writeAsStringSync('x');
expect(await file.exists(), true);
}
@@ -99,6 +119,11 @@ class FileTest extends _BaseTestNative {
expect(await file.readAsString(), '\u20ac');
}
+ test_writeAsBytesSync_directory() async {
+ file.createDirectory();
+ expect(() => file.writeAsBytesSync([0]), _throwsFileSystemException);
+ }
+
test_writeAsBytesSync_modifyAfterRead() async {
file.writeAsBytesSync([1]);
(await file.readAsBytes())[0] = 2;
@@ -118,6 +143,11 @@ class FileTest extends _BaseTestNative {
expect(await file.readAsBytes(), [2]);
}
+ test_writeAsStringSync_directory() async {
+ file.createDirectory();
+ expect(() => file.writeAsStringSync(''), _throwsFileSystemException);
+ }
+
test_writeAsStringSync_overwrite() async {
file.writeAsStringSync('first');
file.writeAsStringSync('second');
« no previous file with comments | « pkg/front_end/lib/memory_file_system.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698