gralculator/internal/version/version_test.go
Grok b78f6d7c2b
Some checks failed
Release / Create Release (push) Failing after 12s
CI / Test (push) Successful in 16s
CI / Build (push) Has been skipped
CI / Lint (push) Failing after 28s
test: add thorough test coverage for engine, UI model, and version
- Expanded calc_test.go with additional cases for decimal point, backspace, sign change, mod, div0, multi-step ops, negatives, format, is-integer with entry, etc. (calc coverage to ~86%)
- New ui_test.go: unit tests for App (New, Update key sequences for digits/ops/MOD/HEX entry/base cycle/CERR/clears/flashes/pressed state, View contains checks). ui coverage ~82%
- New version_test.go: 100% for String()
- All tests pass (go test ./...); total project coverage ~81%
- Complements the HEX entry and UI polish work.
- Uses table-friendly and direct model testing suitable for the Bubble Tea spike.
2026-06-06 16:02:56 +01:00

24 lines
434 B
Go

package version
import (
"strings"
"testing"
)
func TestString(t *testing.T) {
// default dev
if got := String(); got != "dev" {
t.Errorf("default: want dev, got %s", got)
}
// with commit
Version = "1.0.0"
Commit = "abc123"
if got := String(); !strings.Contains(got, "1.0.0") || !strings.Contains(got, "abc123") {
t.Errorf("with commit: want version-commit, got %s", got)
}
// reset
Version = "dev"
Commit = ""
}