mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:39:08 +00:00
Refactoring part 1: Fix some annoying linter warnings in API code (#1064)
* names, constants of reusable strings, removed unneeded `if`, replaced deprecated imports * more deprecated imports replaced * What is this?)) * Fix a path and quote a var in Dockerfile * Addressing review comments --------- Co-authored-by: Konstantin Koval <kkb@ukr.net>
This commit is contained in:
@@ -17,7 +17,9 @@ func TestMain(m *testing.M) {
|
||||
func setPathWithCurrent(paths ...string) func() {
|
||||
_, file, _, ok := runtime.Caller(0)
|
||||
if !ok {
|
||||
return func() {}
|
||||
return func() {
|
||||
// Return an empty function in case of error
|
||||
}
|
||||
}
|
||||
|
||||
base := filepath.Dir(file)
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"github.com/photoview/photoview/api/scanner/media_encoding/executable_worker"
|
||||
)
|
||||
|
||||
const testdataBinPath = "./testdata/bin"
|
||||
|
||||
func TestMagickCliNotExist(t *testing.T) {
|
||||
done := setPathWithCurrent()
|
||||
defer done()
|
||||
@@ -18,7 +20,7 @@ func TestMagickCliNotExist(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMagickCliIgnore(t *testing.T) {
|
||||
donePath := setPathWithCurrent("./testdata/bin")
|
||||
donePath := setPathWithCurrent(testdataBinPath)
|
||||
defer donePath()
|
||||
|
||||
doneDisableRaw := setEnv("PHOTOVIEW_DISABLE_RAW_PROCESSING", "true")
|
||||
@@ -31,7 +33,7 @@ func TestMagickCliIgnore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMagickCliFail(t *testing.T) {
|
||||
donePath := setPathWithCurrent("./testdata/bin")
|
||||
donePath := setPathWithCurrent(testdataBinPath)
|
||||
defer donePath()
|
||||
|
||||
executable_worker.InitializeExecutableWorkers()
|
||||
@@ -53,7 +55,7 @@ func TestMagickCliFail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMagickCliSucceed(t *testing.T) {
|
||||
donePath := setPathWithCurrent("./testdata/bin")
|
||||
donePath := setPathWithCurrent(testdataBinPath)
|
||||
defer donePath()
|
||||
|
||||
executable_worker.InitializeExecutableWorkers()
|
||||
|
||||
Reference in New Issue
Block a user