From 5b9a75a1520a198c9c6b1f1f55e05c9f4aab5629 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 22 Jun 2026 04:24:11 -0400 Subject: feat: map now only reveals with exploration. players can set custom map symbols. --- internal/game/map_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'internal/game/map_test.go') diff --git a/internal/game/map_test.go b/internal/game/map_test.go index a695c1b..b7d9f01 100644 --- a/internal/game/map_test.go +++ b/internal/game/map_test.go @@ -4,6 +4,7 @@ import ( "strings" "testing" + "thehouseoficarus/internal/color" "thehouseoficarus/internal/world" ) @@ -51,7 +52,7 @@ func TestBuildTinyMap(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - lines := buildTinyMap(g, tt.roomID, mg) + lines := buildTinyMap(g, nil, tt.roomID, mg) if len(lines) != 7 { t.Fatalf("expected 7 lines, got %d", len(lines)) } @@ -65,8 +66,8 @@ func TestBuildTinyMap(t *testing.T) { if !strings.HasPrefix(lines[i], "║") || !strings.HasSuffix(lines[i], "║") { t.Errorf("line %d: should have ║ borders, got %s", i, lines[i]) } - if len([]rune(lines[i])) != 7 { - t.Errorf("line %d: expected 7 runes, got %d in %q", i, len([]rune(lines[i])), lines[i]) + if color.VisibleLen(lines[i]) != 7 { + t.Errorf("line %d: expected 7 visible runes, got %d in %q", i, color.VisibleLen(lines[i]), lines[i]) } } t.Logf("Room %d map:\n%s", tt.roomID, strings.Join(lines, "\n")) @@ -115,13 +116,13 @@ func TestBuildFullMap(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - lines := buildFullMap(g, tt.roomID, tt.width, tt.height, mg) + lines := buildFullMap(g, nil, tt.roomID, tt.width, tt.height, mg) if len(lines) != tt.height { t.Errorf("expected %d lines, got %d", tt.height, len(lines)) } for i, line := range lines { - if len([]rune(line)) != tt.width { - t.Errorf("line %d: expected %d runes, got %d in %q", i, tt.width, len([]rune(line)), line) + if color.VisibleLen(line) != tt.width { + t.Errorf("line %d: expected %d visible runes, got %d in %q", i, tt.width, color.VisibleLen(line), line) } } t.Logf("Room %d %dx%d map:\n%s", tt.roomID, tt.width, tt.height, strings.Join(lines, "\n")) -- cgit v1.2.3