Move files out of pkg into root
parent
9d186a3b3f
commit
cb73af83a0
15
Makefile
15
Makefile
|
@ -1,16 +1,7 @@
|
|||
all: release
|
||||
all: test
|
||||
|
||||
dependencies:
|
||||
go mod tidy
|
||||
|
||||
build: dependencies
|
||||
go build -x -v
|
||||
|
||||
release: dependencies
|
||||
go build -x -v -ldflags "-s -w"
|
||||
|
||||
test: dependencies
|
||||
go test ./pkg
|
||||
test:
|
||||
go test
|
||||
|
||||
goimports_everything:
|
||||
find . -name "*.go" -exec goimports -w {} \;
|
||||
|
|
|
@ -35,7 +35,7 @@ technically valid = haha hmm...
|
|||
|
||||
parsedMap, err := parse(configFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed while parsing the file")
|
||||
t.Errorf("failed while parsing the file")
|
||||
}
|
||||
|
||||
validateMap(t, parsedMap, expectedMap)
|
||||
|
@ -50,7 +50,7 @@ foo=bar=true
|
|||
|
||||
_, err = parse(configFile)
|
||||
if err == nil {
|
||||
t.Fatalf("parse did not thrown an error when it was supposed to")
|
||||
t.Errorf("parse did not thrown an error when it was supposed to")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,28 +63,28 @@ Something here with no equals to split on
|
|||
|
||||
_, err = parse(configFile)
|
||||
if err == nil {
|
||||
t.Fatalf("parse did not thrown an error when it was supposed to")
|
||||
t.Errorf("parse did not thrown an error when it was supposed to")
|
||||
}
|
||||
}
|
||||
|
||||
func validateMap(t *testing.T, given map[string]string, expected map[string]string) {
|
||||
if given == nil {
|
||||
t.Fatalf("given map was nil")
|
||||
t.Errorf("given map was nil")
|
||||
}
|
||||
|
||||
if expected == nil {
|
||||
t.Fatalf("expected map was nil")
|
||||
t.Errorf("expected map was nil")
|
||||
}
|
||||
|
||||
expectedLen := len(expected)
|
||||
givenLen := len(given)
|
||||
if expectedLen != givenLen {
|
||||
t.Fatalf("size mismatch on maps - expected %v, given %v", expectedLen, givenLen)
|
||||
t.Errorf("size mismatch on maps - expected %v, given %v", expectedLen, givenLen)
|
||||
}
|
||||
|
||||
for k, v := range expected {
|
||||
if v != given[k] {
|
||||
t.Fatalf("incorrect value for key %v - expected %v, given %v", k, expected[k], given[k])
|
||||
t.Errorf("incorrect value for key %v - expected %v, given %v", k, expected[k], given[k])
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue