diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a289a0..b34782c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,4 +13,5 @@ jobs: with: go-version: '1.21' - run: test -z $(gofmt -l .) + - run: go test ./... - run: go build ./cmd/gokart.go diff --git a/internal/execTime_test.go b/internal/execTime_test.go new file mode 100644 index 0000000..a2ef9a6 --- /dev/null +++ b/internal/execTime_test.go @@ -0,0 +1,18 @@ +package internal + +import "testing" + +func TestFormatMinutesSeconds(t *testing.T) { + cases := map[float64]string{ + 3.14: "3.1s", + 60: "1m 0.0s", + 3712.5: "61m 52.5s", + } + + for in, expected := range cases { + actual := formatMinutesSeconds(in) + if actual != expected { + t.Errorf("formatMinutesSeconds(%f) = %s, expected %s", in, actual, expected) + } + } +}