diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-17 21:33:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-17 21:33:45 +0300 |
| commit | 88103657fb230bb41217a06aa5602ae23e7acb8b (patch) | |
| tree | 524c437e4e40ee5d6713b6ea5414ad975654cc52 /internal/stats/debugstring_test.go | |
| parent | 2b6232704ecc90630196b9f829f966533e5cdccd (diff) | |
feat(stats,tmux): global Σ@window stats across processes with flocked cache; width mitigation (narrow/maxlen); configurable [stats] window_minutes; robust coverage parsing; docs update\n\n- Add internal/stats with windowed event cache + flock + atomic writes\n- Wire stats into LSP/CLI/Tmux Action; tmux shows Σ@window with per-model tail\n- HEXAI_TMUX_STATUS_NARROW and HEXAI_TMUX_STATUS_MAXLEN for width control\n- Add [stats] window_minutes to config and apply on startup\n- Improve Magefile coverage handling; add tests to lift coverage >85%\n- Update docs/tmux.md and config example
Diffstat (limited to 'internal/stats/debugstring_test.go')
| -rw-r--r-- | internal/stats/debugstring_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/stats/debugstring_test.go b/internal/stats/debugstring_test.go new file mode 100644 index 0000000..88b2a5e --- /dev/null +++ b/internal/stats/debugstring_test.go @@ -0,0 +1,22 @@ +package stats + +import "testing" + +func TestSnapshotDebugString(t *testing.T) { + s := Snapshot{} + s.Global.Reqs = 42 + s.RPM = 3.14 + got := s.DebugString() + if got == "" || !contains(got, "Σ reqs=42") || !contains(got, "rpm=") { + t.Fatalf("unexpected debug string: %q", got) + } +} + +func contains(s, sub string) bool { + for i := 0; i+len(sub) <= len(s); i++ { + if s[i:i+len(sub)] == sub { + return true + } + } + return false +} |
