aboutsummaryrefslogtreecommitdiff
path: root/internal/osutil/osutil_test.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-24 21:13:56 +0800
committerᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-24 21:13:56 +0800
commit0c064b1b79bc5fe0558fb5ba1a185cfc27a77f75 (patch)
treea8d28225a2a36ee2e92a83cf64016466d9eb39f4 /internal/osutil/osutil_test.go
parent63e56facbf96204e32c5407b3d5ff8d3d3612bac (diff)
cmd/web: fix error when Unix socket not exists
Diffstat (limited to 'internal/osutil/osutil_test.go')
-rw-r--r--internal/osutil/osutil_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/osutil/osutil_test.go b/internal/osutil/osutil_test.go
index adaebebf..4c9a2ad7 100644
--- a/internal/osutil/osutil_test.go
+++ b/internal/osutil/osutil_test.go
@@ -32,3 +32,26 @@ func TestIsFile(t *testing.T) {
})
}
}
+
+func TestIsExist(t *testing.T) {
+ tests := []struct {
+ path string
+ expVal bool
+ }{
+ {
+ path: "osutil.go",
+ expVal: true,
+ }, {
+ path: "../osutil",
+ expVal: true,
+ }, {
+ path: "not_found",
+ expVal: false,
+ },
+ }
+ for _, test := range tests {
+ t.Run("", func(t *testing.T) {
+ assert.Equal(t, test.expVal, IsExist(test.path))
+ })
+ }
+}