diff options
| author | Shulhan <ms@kilabit.info> | 2023-11-02 21:30:49 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-11-05 12:02:52 +0700 |
| commit | 3dbed6f1d8e797af40d8fe4eefe5c30bf89ffce7 (patch) | |
| tree | 3f0ab88c6b0d8be98a83ca39117584fdf9d9ec52 /lib/memfs/memfs_test.go | |
| parent | d714934c3b42d9fba7c8751532f92cb61c23e1e2 (diff) | |
| download | pakakeh.go-3dbed6f1d8e797af40d8fe4eefe5c30bf89ffce7.tar.xz | |
lib/memfs: include empty directory
Even thought empty directory does not contains file, from the parent
node _it is_ part of their content.
Also, there is a use case where memfs use as virtual file system (VFS),
as a layer with file system, where user can view list of directory,
create a directory or file on the fly.
If we skip scanning empty directory, that directory will not be visible.
Diffstat (limited to 'lib/memfs/memfs_test.go')
| -rw-r--r-- | lib/memfs/memfs_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/memfs/memfs_test.go b/lib/memfs/memfs_test.go index 6d8dbadc..7e210d9e 100644 --- a/lib/memfs/memfs_test.go +++ b/lib/memfs/memfs_test.go @@ -115,10 +115,12 @@ func TestNew(t *testing.T) { expMapKeys: []string{ "/", "/exclude", + "/exclude/dir", "/exclude/index-link.css", "/exclude/index-link.html", "/exclude/index-link.js", "/include", + "/include/dir", "/include/index.css", "/include/index.html", "/include/index.js", @@ -141,9 +143,11 @@ func TestNew(t *testing.T) { expMapKeys: []string{ "/", "/exclude", + "/exclude/dir", "/exclude/index-link.css", "/exclude/index-link.html", "/include", + "/include/dir", "/include/index.css", "/include/index.html", "/index.css", @@ -166,8 +170,10 @@ func TestNew(t *testing.T) { expMapKeys: []string{ "/", "/exclude", + "/exclude/dir", "/exclude/index-link.js", "/include", + "/include/dir", "/include/index.js", "/index.js", }, @@ -669,6 +675,7 @@ func TestMerge(t *testing.T) { Path: "/", Childs: []*Node{ mfsDirect.MustGet("/add"), + mfsInclude.MustGet("/dir"), mfsInclude.MustGet("/index.css"), mfsInclude.MustGet("/index.html"), mfsInclude.MustGet("/index.js"), @@ -678,6 +685,7 @@ func TestMerge(t *testing.T) { "/add": mfsDirect.MustGet("/add"), "/add/file": mfsDirect.MustGet("/add/file"), "/add/file2": mfsDirect.MustGet("/add/file2"), + "/dir": mfsInclude.MustGet("/dir"), "/index.css": mfsInclude.MustGet("/index.css"), "/index.html": mfsInclude.MustGet("/index.html"), "/index.js": mfsInclude.MustGet("/index.js"), |
