aboutsummaryrefslogtreecommitdiff
path: root/lib/memfs/memfs_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-15 02:26:08 +0700
committerShulhan <ms@kilabit.info>2023-11-15 02:26:08 +0700
commitd648ac73198f3a829c68a179c50643fca6cb66ed (patch)
tree7efd5d469efcae626e3f98965218c3baf8ab4fd3 /lib/memfs/memfs_test.go
parent0021f75d8abb4e107287781b88e2556c83c9dc28 (diff)
downloadpakakeh.go-d648ac73198f3a829c68a179c50643fca6cb66ed.tar.xz
lib/memfs: check for empty path on Get
Diffstat (limited to 'lib/memfs/memfs_test.go')
-rw-r--r--lib/memfs/memfs_test.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/memfs/memfs_test.go b/lib/memfs/memfs_test.go
index eb10bcd4..2e02c4f0 100644
--- a/lib/memfs/memfs_test.go
+++ b/lib/memfs/memfs_test.go
@@ -253,7 +253,7 @@ func TestMemFS_AddFile(t *testing.T) {
func TestMemFS_Get(t *testing.T) {
cases := []struct {
- expErr error
+ expErr string
path string
expV []byte
expContentType []string
@@ -263,7 +263,7 @@ func TestMemFS_Get(t *testing.T) {
path: "/exclude",
}, {
path: "/exclude/dir",
- expErr: os.ErrNotExist,
+ expErr: os.ErrNotExist.Error(),
}, {
path: "/exclude/index-link.css",
expV: []byte("body {\n}\n"),
@@ -283,7 +283,7 @@ func TestMemFS_Get(t *testing.T) {
path: "/include",
}, {
path: "/include/dir",
- expErr: os.ErrNotExist,
+ expErr: os.ErrNotExist.Error(),
}, {
path: "/include/index.css",
expV: []byte("body {\n}\n"),
@@ -316,6 +316,9 @@ func TestMemFS_Get(t *testing.T) {
}, {
path: "/plain",
expContentType: []string{"application/octet-stream"},
+ }, {
+ path: ``,
+ expErr: `Get: empty path`,
}}
dir := filepath.Join(_testWD, "/testdata")
@@ -334,7 +337,7 @@ func TestMemFS_Get(t *testing.T) {
for _, c := range cases {
got, err := mfs.Get(c.path)
if err != nil {
- test.Assert(t, c.path+": error", c.expErr, err)
+ test.Assert(t, c.path+": error", c.expErr, err.Error())
continue
}