diff options
| author | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
| commit | 153acb7f644d755c45533b7c5311e3ffa47e8973 (patch) | |
| tree | 7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/player/correct_skill_validity_test.go | |
| parent | 87d08f0151e643951769e323995f1c5ed89ee200 (diff) | |
| download | thehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz | |
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/player/correct_skill_validity_test.go')
| -rw-r--r-- | internal/player/correct_skill_validity_test.go | 21 |
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) + } + } +} |
