// SPDX-License-Identifier: GPL-3.0-or-later package engine import ( "testing" "git.labunix.xyz/krino/internal/enumtest" "git.labunix.xyz/krino/internal/plan" ) // TestEveryKindHasALogAction: every plan.Kind is written to the log under // its own action word - undo reads the log by that word. plan.Kind is an // iota block from 0, so the i-th constant is the value i. func TestEveryKindHasALogAction(t *testing.T) { kinds, err := enumtest.Names("../plan/step.go", "Kind") if err != nil { t.Fatal(err) } seen := map[string]bool{} for i, name := range kinds { func() { defer func() { if r := recover(); r != nil { t.Errorf("plan.%s has no log action: %v", name, r) } }() a := actionName(plan.Kind(i)) if a == "" || seen[a] { t.Errorf("plan.%s logs as %q", name, a) } seen[a] = true }() } }