summaryrefslogtreecommitdiff
path: root/internal/flags/flags_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-02 08:39:35 +0200
committerPaul Buetow <paul@buetow.org>2026-03-02 08:39:35 +0200
commitb3327d17f9f5c7080b05d6d5457cf25550d40ad9 (patch)
tree090e66047c14c9183058bd68a8d4afc12b48f399 /internal/flags/flags_test.go
parent38620359537d77ab10acb888d266d3c6eb16fc9b (diff)
Add --open support for live flamegraph browser launch
Diffstat (limited to 'internal/flags/flags_test.go')
-rw-r--r--internal/flags/flags_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/flags/flags_test.go b/internal/flags/flags_test.go
index a4feb5d..3fa74c6 100644
--- a/internal/flags/flags_test.go
+++ b/internal/flags/flags_test.go
@@ -69,6 +69,12 @@ func TestParseLiveFlagsAndInterval(t *testing.T) {
if got := int(pidFilter.Load()); got != 1234 {
t.Fatalf("global pid filter = %d, want 1234", got)
}
+ if cfg.OpenLiveBrowser {
+ t.Fatalf("expected open-live disabled by default")
+ }
+ if cfg.OpenCommand != "" {
+ t.Fatalf("expected empty open command by default")
+ }
}
func TestParseLiveDefaults(t *testing.T) {
@@ -83,6 +89,28 @@ func TestParseLiveDefaults(t *testing.T) {
if cfg.LiveInterval != 200*time.Millisecond {
t.Fatalf("default live interval = %v, want %v", cfg.LiveInterval, 200*time.Millisecond)
}
+ if cfg.OpenLiveBrowser {
+ t.Fatalf("expected open-live disabled by default")
+ }
+ if cfg.OpenCommand != "" {
+ t.Fatalf("expected empty open command by default")
+ }
+}
+
+func TestParseOpenFlags(t *testing.T) {
+ cfg, err := parseForTest(t, "-live", "-open", "-open-cmd", "chromium --new-window")
+ if err != nil {
+ t.Fatalf("parse returned error: %v", err)
+ }
+ if !cfg.LiveFlamegraph {
+ t.Fatalf("expected live mode enabled")
+ }
+ if !cfg.OpenLiveBrowser {
+ t.Fatalf("expected -open to enable live browser open")
+ }
+ if cfg.OpenCommand != "chromium --new-window" {
+ t.Fatalf("open command = %q, want %q", cfg.OpenCommand, "chromium --new-window")
+ }
}
func TestParseDefaultCollapsedFieldsOrder(t *testing.T) {