aboutsummaryrefslogtreecommitdiff
path: root/internal/osutil
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-19 23:15:57 +0800
committerᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-19 23:15:57 +0800
commit33c6341ccd765fa631d6863aeeca12a6a5e04658 (patch)
tree5d4751b3930042d5ab36047fe748a9d8c8c9b0a7 /internal/osutil
parentb74ecd8a75fc030e818f426ef722a54ca63f45c6 (diff)
osutil: add unit tests
Diffstat (limited to 'internal/osutil')
-rw-r--r--internal/osutil/osutil_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/osutil/osutil_test.go b/internal/osutil/osutil_test.go
new file mode 100644
index 00000000..adaebebf
--- /dev/null
+++ b/internal/osutil/osutil_test.go
@@ -0,0 +1,34 @@
+// Copyright 2020 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package osutil
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestIsFile(t *testing.T) {
+ tests := []struct {
+ path string
+ expVal bool
+ }{
+ {
+ path: "osutil.go",
+ expVal: true,
+ }, {
+ path: "../osutil",
+ expVal: false,
+ }, {
+ path: "not_found",
+ expVal: false,
+ },
+ }
+ for _, test := range tests {
+ t.Run("", func(t *testing.T) {
+ assert.Equal(t, test.expVal, IsFile(test.path))
+ })
+ }
+}