aboutsummaryrefslogtreecommitdiff
path: root/internal/world/correct_audit_fixes_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/world/correct_audit_fixes_test.go')
-rw-r--r--internal/world/correct_audit_fixes_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/world/correct_audit_fixes_test.go b/internal/world/correct_audit_fixes_test.go
new file mode 100644
index 0000000..0ecb87a
--- /dev/null
+++ b/internal/world/correct_audit_fixes_test.go
@@ -0,0 +1,18 @@
+package world
+
+import (
+ "testing"
+
+ "gopkg.in/yaml.v3"
+)
+
+// Regression: a reference-style room object entry (id only) that also carries
+// behavior fields silently lost them at runtime, because the loader always
+// uses the object file. It must now be rejected at load time.
+func TestRoomObjectReferenceRejectsBehaviorFields(t *testing.T) {
+ src := "id: 1\nname: Test\nobjects:\n - id: chest\n on_use:\n - steps:\n - message: hi\n"
+ var r Room
+ if err := yaml.Unmarshal([]byte(src), &r); err == nil {
+ t.Fatal("reference object entry with on_use was accepted; the behavior would be silently lost")
+ }
+}