beads/cmd/bd/cpu_profile_test.go
Julian Knutsen fb52ac6a55
refactor(cli): rename CPU profiling flag (#5126)
Free the conventional --profile namespace for named database profiles while retaining the existing CPU and trace behavior under --cpu-profile.

Agent-Signature: codex-gpt-5.6-terra-high on behalf of CI Bot

Refs: bd-ugz

Co-authored-by: CI Bot <ci@beads.test>
2026-07-28 22:17:13 -07:00

19 lines
649 B
Go

package main
import "testing"
func TestCPUProfileFlagRegistered(t *testing.T) {
flag := rootCmd.PersistentFlags().Lookup("cpu-profile")
if flag == nil {
t.Fatal("--cpu-profile persistent flag is not registered")
}
if got, want := flag.Value.Type(), "bool"; got != want {
t.Errorf("--cpu-profile flag type = %q, want %q", got, want)
}
if got, want := flag.Usage, "Generate CPU profile for performance analysis"; got != want {
t.Errorf("--cpu-profile usage = %q, want %q", got, want)
}
if old := rootCmd.PersistentFlags().Lookup("profile"); old != nil {
t.Error("--profile must not remain registered as the CPU profiling flag")
}
}