blob: 941bfab6b27fa9844c1c68d0379d879713e1ce8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package player
// Regression: craft recipes declare their skill as the recipe TYPE, and not
// every type is a skill (a combine recipe declares "combine"). Callers must be
// able to tell a real skill name from an action name, because Level reads an
// unknown name as a map miss (level 1) and AddSkillXP persists it.
import "testing"
func TestValidSkillRecognizesDeclaredSkillsOnly(t *testing.T) {
for _, s := range AllSkills {
if !ValidSkill(s) {
t.Errorf("ValidSkill(%q) = false, want true", s)
}
}
for _, name := range []SkillName{"combine", "fletch", "craft", "", "not_a_skill"} {
if ValidSkill(name) {
t.Errorf("ValidSkill(%q) = true, want false", name)
}
}
}
|