From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/world/room_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'internal/world/room_test.go') diff --git a/internal/world/room_test.go b/internal/world/room_test.go index 855eba5..893f858 100644 --- a/internal/world/room_test.go +++ b/internal/world/room_test.go @@ -6,6 +6,8 @@ import ( "testing" "gopkg.in/yaml.v3" + "thehouseoficarus/internal/behavior" + "thehouseoficarus/internal/object" ) func writeRoom(t *testing.T, dir string, body string) { @@ -137,3 +139,32 @@ func TestExitDefUnmarshalAlwaysBlocked(t *testing.T) { t.Error("east exit should not have AlwaysBlocked") } } + +func TestRoomObjectMarshalYAMLRoundTripsWander(t *testing.T) { + ro := RoomObject{ + ID: "fence", + WanderRooms: []int{2, 3}, + WanderInterval: 5, + Local: &object.ObjectDef{ + Name: "fence", + Description: behavior.DescList{{Text: "A fence."}}, + }, + } + data, err := yaml.Marshal(ro) + if err != nil { + t.Fatalf("marshal: %v", err) + } + var out RoomObject + if err := yaml.Unmarshal(data, &out); err != nil { + t.Fatalf("unmarshal: %v", err) + } + if len(out.WanderRooms) != 2 || out.WanderRooms[0] != 2 || out.WanderRooms[1] != 3 { + t.Fatalf("wander_rooms round trip = %v, want [2 3]", out.WanderRooms) + } + if out.WanderInterval != 5 { + t.Fatalf("wander_interval round trip = %v, want 5", out.WanderInterval) + } + if out.Local == nil || out.Local.Name != "fence" { + t.Fatalf("local object lost: %+v", out.Local) + } +} -- cgit v1.2.3