blob: 416da2ac181059471b6929822db24c1b86c18178 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// SPDX-License-Identifier: GPL-3.0-or-later
package engine
import (
"testing"
"krino/internal/enumtest"
"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
}()
}
}
|