aboutsummaryrefslogtreecommitdiff
path: root/internal/player/correct_skill_validity_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/player/correct_skill_validity_test.go')
-rw-r--r--internal/player/correct_skill_validity_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/player/correct_skill_validity_test.go b/internal/player/correct_skill_validity_test.go
new file mode 100644
index 0000000..941bfab
--- /dev/null
+++ b/internal/player/correct_skill_validity_test.go
@@ -0,0 +1,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)
+ }
+ }
+}