commit 976ae328229ec851ebb69df353aeaf0b320b02ba
parent f647c31e1d46e48d87857bee778c6cf8ef73d2e4
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 15 Dec 2024 17:46:02 -0500
determine path based on wd in go
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/cmd/main_test.go b/cmd/main_test.go
@@ -32,7 +32,8 @@ const (
)
var (
- binary = filepath.Join("..", "target", "lb")
+ target = filepath.Join("..", "target")
+ binary = filepath.Join(target, "lb")
//go:embed tests/*
testingFiles embed.FS
)
@@ -50,6 +51,11 @@ type (
func newRunner(profile string) (runner, error) {
t := filepath.Join("testdata", profile)
l := filepath.Join(t, "actual.log")
+ wd, err := os.Getwd()
+ if err != nil {
+ return runner{}, err
+ }
+ os.Setenv("PATH", fmt.Sprintf("%s%c%s", filepath.Join(wd, target), os.PathListSeparator, os.Getenv("PATH")))
if err := os.RemoveAll(t); err != nil {
return runner{}, err
}
diff --git a/justfile b/justfile
@@ -17,7 +17,7 @@ unittest:
check: unittest tests
tests: build
- PATH="$PWD/{{target}}:$PATH" {{gotest}} cmd/main_test.go
+ {{gotest}} cmd/main_test.go
clean:
rm -f "{{object}}"