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

Unified Diff: pkg/analyzer/test/file_system/memory_file_system_test.dart

Issue 2067613002: Add Resource.delete() method. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
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 ef4230184eb04244aa0d55ece806f3544276c07a..a6adddd21f97ca7bd4329d63b77db484eb07f870 100644
--- a/pkg/analyzer/test/file_system/memory_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/memory_file_system_test.dart
@@ -48,6 +48,14 @@ class FileSystemExceptionTest {
class FileTest {
MemoryResourceProvider provider = new MemoryResourceProvider();
+ void test_delete() {
+ File file = provider.newFile('/foo/file.txt', 'content');
+ expect(file.exists, isTrue);
+ // delete
+ file.delete();
+ expect(file.exists, isFalse);
+ }
+
void test_equals_beforeAndAfterCreate() {
String path = '/file.txt';
File file1 = provider.getResource(path);
@@ -241,6 +249,23 @@ class FolderTest {
expect(folder.contains('/foo/bar'), isFalse);
}
+ void test_delete() {
+ Folder folder = provider.newFolder('/foo');
+ Folder barFolder = provider.newFolder('/foo/bar');
+ File aFile = provider.newFile('/foo/bar/a.txt', '');
+ File bFile = provider.newFile('/foo/b.txt', '');
+ expect(folder.exists, isTrue);
+ expect(barFolder.exists, isTrue);
+ expect(aFile.exists, isTrue);
+ expect(bFile.exists, isTrue);
+ // delete 'folder'
+ folder.delete();
+ expect(folder.exists, isFalse);
+ expect(barFolder.exists, isFalse);
+ expect(aFile.exists, isFalse);
+ expect(bFile.exists, isFalse);
+ }
+
void test_equal_false() {
String path2 = '/foo/baz';
Folder folder2 = provider.newFolder(path2);

Powered by Google App Engine
This is Rietveld 408576698