mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-05 11:06:23 -07:00
Fix PanicIfNotTest and GoToGochanRoot
This commit is contained in:
parent
2b0a6a9d54
commit
64e1e6e15a
1 changed files with 3 additions and 3 deletions
|
@ -3,7 +3,7 @@ package testutil
|
|||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ const (
|
|||
|
||||
// PanicIfNotTest panics if the function was called directly or indirectly by a test function via go test
|
||||
func PanicIfNotTest() {
|
||||
if !strings.HasSuffix(os.Args[0], ".test") && os.Args[1] != "-test.run" {
|
||||
if !strings.HasSuffix(os.Args[0], ".test") && !strings.HasSuffix(os.Args[0], ".test.exe") && os.Args[1] != "-test.run" {
|
||||
panic("the testutil package should only be used in tests")
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ func GoToGochanRoot(t *testing.T) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if path.Base(dir) == "gochan" {
|
||||
if filepath.Base(dir) == "gochan" {
|
||||
return dir, nil
|
||||
}
|
||||
if err = os.Chdir(".."); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue