aboutsummaryrefslogtreecommitdiff
path: root/internal/behavior/yml_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-06 12:57:23 -0400
committerhistoria <[not public]>2026-10-06 12:57:23 -0400
commit9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch)
tree0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/behavior/yml_test.go
parent4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff)
downloadthehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/behavior/yml_test.go')
-rw-r--r--internal/behavior/yml_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/behavior/yml_test.go b/internal/behavior/yml_test.go
index 9452e9e..82acb19 100644
--- a/internal/behavior/yml_test.go
+++ b/internal/behavior/yml_test.go
@@ -27,3 +27,38 @@ func TestWalkYAMLDirIncludesYml(t *testing.T) {
t.Fatalf("WalkYAMLDir ids = %v, want both a and b", ids)
}
}
+
+func TestBuildPathIndexIncludesYml(t *testing.T) {
+ dir := t.TempDir()
+ if err := os.WriteFile(filepath.Join(dir, "a.yaml"), []byte("x: 1"), 0644); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(dir, "b.yml"), []byte("x: 2"), 0644); err != nil {
+ t.Fatal(err)
+ }
+ idx := BuildPathIndex(dir)
+ if idx["a"] == "" || idx["b"] == "" {
+ t.Fatalf("BuildPathIndex = %v, want both a and b", idx)
+ }
+}
+
+func TestBuildRoomIndexIncludesYml(t *testing.T) {
+ dir := t.TempDir()
+ if err := os.WriteFile(filepath.Join(dir, "1001.yaml"), []byte("name: a"), 0644); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(dir, "1002.yml"), []byte("name: b"), 0644); err != nil {
+ t.Fatal(err)
+ }
+ idx := BuildRoomIndex(dir)
+ if idx[1001] == "" || idx[1002] == "" {
+ t.Fatalf("BuildRoomIndex = %v, want both 1001 and 1002", idx)
+ }
+}
+
+func TestLoadDropTableRejectsPathEscape(t *testing.T) {
+ dataDir := t.TempDir()
+ if _, err := LoadDropTable(dataDir, "../../../etc/passwd"); err == nil {
+ t.Fatal("accepted a path-escaping drop table id")
+ }
+}