Skip to content

Commit 653c2fd

Browse files
authored
More work towards proper testing (flutter#16)
- Add stub tests for Directory. Please review for coverage; impl will come later - Rename tests to follow common pattern - Fix some cases where we weren't matching the behavior of dart:io libraries
1 parent 1520d7c commit 653c2fd

File tree

4 files changed

+182
-41
lines changed

4 files changed

+182
-41
lines changed

lib/src/backends/memory/memory_directory.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class _MemoryDirectory extends _MemoryFileSystemEntity implements Directory {
4848
String basename = fileSystem._context.basename(fullPath);
4949
_DirectoryNode node = fileSystem._findNode(dirname);
5050
_checkExists(node, () => dirname);
51+
_checkIsDir(node, () => dirname);
5152
var name = () => '$basename$_tempCounter';
5253
while (node.children.containsKey(name())) {
5354
_tempCounter++;

lib/src/backends/memory/memory_file_system.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ class MemoryFileSystem extends FileSystem {
9999

100100
@override
101101
bool identicalSync(String path1, String path2) {
102-
_Node node1 = _findNode(path1, resolveTailLink: true);
103-
_Node node2 = _findNode(path2, resolveTailLink: true);
102+
_Node node1 = _findNode(path1);
103+
_checkExists(node1, () => path1);
104+
_Node node2 = _findNode(path2);
105+
_checkExists(node2, () => path2);
104106
return node1 != null && node1 == node2;
105107
}
106108

lib/src/backends/memory/node.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ class _FileNode extends _RealNode {
134134
int get size => content.length;
135135

136136
void copyFrom(_FileNode source) {
137-
changed = new DateTime.now().millisecondsSinceEpoch;
138-
modified = new DateTime.now().millisecondsSinceEpoch;
137+
modified = changed = new DateTime.now().millisecondsSinceEpoch;
139138
accessed = source.accessed;
140139
mode = source.mode;
141140
content = new List<int>.from(content);

0 commit comments

Comments
 (0)