From 584a64a1cc3646aeae6acb441ae92480a663ebbe Mon Sep 17 00:00:00 2001 From: Niels-Ole Lambertz Date: Sun, 23 Jul 2023 13:53:55 +0200 Subject: [PATCH] enabling testing subpackages --- Makefile | 2 +- main_test.go | 31 ------------------------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 8768db0..1ad06fe 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ run: CGO_ENABLED=$(CGO_ENABLED) go run . test: - CGO_ENABLED=$(CGO_ENABLED) go test . + CGO_ENABLED=$(CGO_ENABLED) go test ./... .PHONY: \ build \ diff --git a/main_test.go b/main_test.go index 510a5cc..fd45986 100644 --- a/main_test.go +++ b/main_test.go @@ -10,37 +10,6 @@ import ( "github.com/nielsole/go_tile/utils" ) -func TestParse(t *testing.T) { - z, x, y, ext, err := utils.ParsePath("/tile/4/3/2.webp") - if err != nil { - t.Error(err) - } - if z != 4 || x != 3 || y != 2 || ext != "webp" { - t.Fail() - } -} - -func TestParseError(t *testing.T) { - invalid_paths := []string{ - "/tile/4/3/2", - "/tile/4/3/2.jpg", - "/tile/4/3/2.png/", - "/tile/4/3/2.png/3", - "/tile/4/3/2.png/3/4", - "/tile/-1/3/2.png", - "/tile/1.5/3/2.png", - "/tile/10000/3.5/2.png", - "/tile/100000000000000000000000000000000000000000000000000000000000000000/3/2.5.png", - "/tile/abc/3/2.png", - } - for _, path := range invalid_paths { - _, _, _, _, err := utils.ParsePath(path) - if err == nil { - t.Errorf("expected error for path %s", path) - } - } -} - // cpu: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz // BenchmarkPngRead-4 88027 13260 ns/op // BenchmarkWriteTileResponse-4 55233 21662 ns/op