summaryrefslogtreecommitdiff
path: root/internal/flags/flags_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-13 22:18:17 +0300
committerPaul Buetow <paul@buetow.org>2026-05-13 22:18:17 +0300
commit34d88ba4c82dac2646db27c74e1cafb0c97dbcf2 (patch)
treef2897b39ad0fb1b23b3532e81da277959421a32d /internal/flags/flags_test.go
parent251894cf3375812564ecf28392179b395cdda9c7 (diff)
add TUIFastRefreshInterval flag to flags.Config
Add TUIFastRefreshInterval time.Duration to flags.Config struct with a default of 250ms and register it as the -tui-fast-refresh CLI flag so callers can tune or disable the high-frequency TUI refresh cadence for the flamegraph and stream tabs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/flags/flags_test.go')
-rw-r--r--internal/flags/flags_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/flags/flags_test.go b/internal/flags/flags_test.go
index d4697d6..1feeafd 100644
--- a/internal/flags/flags_test.go
+++ b/internal/flags/flags_test.go
@@ -255,3 +255,38 @@ func TestParsePositiveMapSizeAccepted(t *testing.T) {
t.Fatalf("EventMapSize = %d, want 8192", cfg.EventMapSize)
}
}
+
+func TestParseTUIFastRefreshDefault(t *testing.T) {
+ // Default should be 250ms — the high-frequency refresh cadence used by
+ // the flamegraph and stream tabs when no explicit flag is provided.
+ cfg, err := parseForTest(t)
+ if err != nil {
+ t.Fatalf("parse returned error: %v", err)
+ }
+ if cfg.TUIFastRefreshInterval != 250*time.Millisecond {
+ t.Fatalf("default TUIFastRefreshInterval = %v, want 250ms", cfg.TUIFastRefreshInterval)
+ }
+}
+
+func TestParseTUIFastRefreshOverride(t *testing.T) {
+ // An explicit -tui-fast-refresh value must be respected and stored on cfg.
+ cfg, err := parseForTest(t, "-tui-fast-refresh", "100ms")
+ if err != nil {
+ t.Fatalf("parse returned error: %v", err)
+ }
+ if cfg.TUIFastRefreshInterval != 100*time.Millisecond {
+ t.Fatalf("TUIFastRefreshInterval = %v, want 100ms", cfg.TUIFastRefreshInterval)
+ }
+}
+
+func TestParseTUIFastRefreshZeroDisables(t *testing.T) {
+ // A zero value is valid and means "disable high-frequency refresh",
+ // falling back to the default Bubble Tea tick rate.
+ cfg, err := parseForTest(t, "-tui-fast-refresh", "0")
+ if err != nil {
+ t.Fatalf("parse returned error: %v", err)
+ }
+ if cfg.TUIFastRefreshInterval != 0 {
+ t.Fatalf("TUIFastRefreshInterval = %v, want 0 (disabled)", cfg.TUIFastRefreshInterval)
+ }
+}