aboutsummaryrefslogtreecommitdiff
path: root/internal/osutil/osutil_test.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-04-11 20:18:05 +0800
committerGitHub <noreply@github.com>2020-04-11 20:18:05 +0800
commit41f56ad05d12520bb90f91889fa979465d0b3d6b (patch)
tree1ec7bc62a427ec2da011e882c61f2bfe04adef37 /internal/osutil/osutil_test.go
parent76bb647d2437dbdea86ac1a0caf5d768ab924e18 (diff)
login_source: migrate to GORM and add tests (#6090)
* Use GORM in all write paths * Migrate to GORM * Fix lint errors * Use GORM to init table * dbutil: make writer detect error * Add more tests * Rename to clearTables * db: finish adding tests * osutil: add tests * Fix load source files path
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 8c45f5c0..ca2c75bf 100644
--- a/internal/osutil/osutil_test.go
+++ b/internal/osutil/osutil_test.go
@@ -33,6 +33,29 @@ func TestIsFile(t *testing.T) {
}
}
+func TestIsDir(t *testing.T) {
+ tests := []struct {
+ path string
+ expVal bool
+ }{
+ {
+ path: "osutil.go",
+ expVal: false,
+ }, {
+ path: "../osutil",
+ expVal: true,
+ }, {
+ path: "not_found",
+ expVal: false,
+ },
+ }
+ for _, test := range tests {
+ t.Run("", func(t *testing.T) {
+ assert.Equal(t, test.expVal, IsDir(test.path))
+ })
+ }
+}
+
func TestIsExist(t *testing.T) {
tests := []struct {
path string