blob: 0ecb87a0b08563989781b3603b90d634a86311f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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")
}
}
|