diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-04-19 04:24:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-19 04:24:08 +0800 |
commit | c0fd6042fd56646f24275785faf5cd40ed8ab2c2 (patch) | |
tree | 6e448c85aefed0edeacf396608b7667c43e14d63 /internal/db/repo_editor_test.go | |
parent | fc57c921b1716f0f84b5b2d4d5693091c48a4b2d (diff) |
test: remove the use of goconvey (#6123)
Diffstat (limited to 'internal/db/repo_editor_test.go')
-rw-r--r-- | internal/db/repo_editor_test.go | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/internal/db/repo_editor_test.go b/internal/db/repo_editor_test.go index 18e844d0..1b7d2265 100644 --- a/internal/db/repo_editor_test.go +++ b/internal/db/repo_editor_test.go @@ -5,30 +5,29 @@ package db import ( - "os" + "path/filepath" "testing" - . "github.com/smartystreets/goconvey/convey" + "github.com/stretchr/testify/assert" ) func Test_isRepositoryGitPath(t *testing.T) { - Convey("Check if path is or resides inside '.git'", t, func() { - sep := string(os.PathSeparator) - testCases := []struct { - path string - expect bool - }{ - {"." + sep + ".git", true}, - {"." + sep + ".git" + sep + "", true}, - {"." + sep + ".git" + sep + "hooks" + sep + "pre-commit", true}, - {".git" + sep + "hooks", true}, - {"dir" + sep + ".git", true}, + tests := []struct { + path string + expVal bool + }{ + {path: filepath.Join(".", ".git"), expVal: true}, + {path: filepath.Join(".", ".git", ""), expVal: true}, + {path: filepath.Join(".", ".git", "hooks", "pre-commit"), expVal: true}, + {path: filepath.Join(".git", "hooks"), expVal: true}, + {path: filepath.Join("dir", ".git"), expVal: true}, - {".gitignore", false}, - {"dir" + sep + ".gitkeep", false}, - } - for _, tc := range testCases { - So(isRepositoryGitPath(tc.path), ShouldEqual, tc.expect) - } - }) + {path: filepath.Join(".gitignore"), expVal: false}, + {path: filepath.Join("dir", ".gitkeep"), expVal: false}, + } + for _, test := range tests { + t.Run("", func(t *testing.T) { + assert.Equal(t, test.expVal, isRepositoryGitPath(test.path)) + }) + } } |