From 153acb7f644d755c45533b7c5311e3ffa47e8973 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 05:31:09 -0400 Subject: fix: harden engine across casino, economy, concurrency, security, and content --- internal/player/correct_skill_validity_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 internal/player/correct_skill_validity_test.go (limited to 'internal/player/correct_skill_validity_test.go') 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) + } + } +} -- cgit v1.2.3