Files
horse/go/skill_test.go

37 lines
861 B
Go

package horse_test
import (
"cmp"
"slices"
"strings"
"sync"
"testing"
horse "git.sunturtle.xyz/zephyr/horse/go"
"git.sunturtle.xyz/zephyr/horse/go/global"
)
var SortedSkills = sync.OnceValue(func() []horse.Skill {
skills := make([]horse.Skill, 0, len(global.AllSkills))
for _, v := range global.AllSkills {
skills = append(skills, v)
}
slices.SortFunc(skills, func(a, b horse.Skill) int { return cmp.Compare(a.ID, b.ID) })
return skills
})
func TestSkillStrings(t *testing.T) {
t.Parallel()
for _, s := range SortedSkills() {
// We could check that s.ID.String() matches s.Name,
// but that may be awkward for inherited skills.
for _, a := range s.Activations {
for _, abil := range a.Abilities {
if n := abil.Type.String(); strings.HasPrefix(n, "AbilityType(") {
t.Errorf("%v %s: %s", s.ID, s.Name, n)
}
}
}
}
}