Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_walk_unittest.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_walk_unittest.py |
| similarity index 74% |
| copy from third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py |
| copy to third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_walk_unittest.py |
| index 561959ad5610989b637af3d5c0ee344c251afb2b..53541d67d891bd0d88464d475283ab117b7a3454 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock_walk_unittest.py |
| @@ -28,8 +28,9 @@ |
| import unittest |
| - |
| +from webkitpy.common.host_mock import MockHost |
| from webkitpy.common.system import filesystem_mock |
| +from webkitpy.common.system.filesystem_mock import MockFileSystem |
| from webkitpy.common.system import filesystem_unittest |
| @@ -84,3 +85,26 @@ class MockFileSystemTest(unittest.TestCase, filesystem_unittest.GenericFileSyste |
| def test_relpath_win32(self): |
| pass |
| + |
| + def test_filesystem_walk(self): |
| + mock_dir = 'foo' |
| + mock_files = {'foo/bar/baz': '', |
| + 'foo/a': '', |
| + 'foo/b': '', |
| + 'foo/c': ''} |
| + host = MockHost() |
| + host.filesystem = MockFileSystem(files=mock_files) |
| + self.assertEquals(host.filesystem.walk(mock_dir), [('foo', ['bar'], ['a', 'b', 'c']), ('foo/bar', [], ['baz'])]) |
| + |
| + def test_filesystem_walk_deeply_nested(self): |
| + mock_dir = 'foo' |
| + mock_files = {'foo/bar/baz': '', |
| + 'foo/bar/quux': '', |
| + 'foo/a/x': '', |
| + 'foo/a/y': '', |
| + 'foo/a/z/lyrics': '', |
| + 'foo/b': '', |
| + 'foo/c': ''} |
| + host = MockHost() |
| + host.filesystem = MockFileSystem(files=mock_files) |
| + self.assertEquals(host.filesystem.walk(mock_dir), [('foo', ['a', 'bar'], ['c', 'b']), ('foo/a', ['z'], ['x', 'y']), ('foo/a/z', [], ['lyrics']), ('foo/bar', [], ['quux', 'baz'])]) |
|
qyearsley
2016/06/02 00:07:14
Style nit: this line is a bit long, and could pote
|