aboutsummaryrefslogtreecommitdiff
path: root/internal/game/correct_audit_fixes_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/correct_audit_fixes_test.go')
-rw-r--r--internal/game/correct_audit_fixes_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/game/correct_audit_fixes_test.go b/internal/game/correct_audit_fixes_test.go
index 90fdc53..681843c 100644
--- a/internal/game/correct_audit_fixes_test.go
+++ b/internal/game/correct_audit_fixes_test.go
@@ -6,6 +6,7 @@ import (
"thehouseoficarus/internal/behavior"
"thehouseoficarus/internal/casino"
"thehouseoficarus/internal/item"
+ "thehouseoficarus/internal/net"
"thehouseoficarus/internal/prediction"
)
@@ -87,6 +88,22 @@ func TestGlobalCommandPreservesArgumentCase(t *testing.T) {
}
}
+// Regression: `get 5 credits` used to sweep the whole purse headroom.
+func TestPickupCreditsHonorsRequestedQuantity(t *testing.T) {
+ h := newHarness(t)
+ h.seedAccount("alice")
+ p := h.seedCharacter("alice", "alice")
+ h.g.RunOnOwner(func() {
+ p.Credits = 0
+ h.g.World.AddGroundItem(p.RoomID, "credits", 10)
+ sess := &net.Session{Player: p, Conn: newChanConn()}
+ h.g.pickupCredits(sess, p, "credits", 5)
+ if p.Credits != 5 {
+ t.Errorf("credits = %d, want 5 (output: %s)", p.Credits, sess.Conn.(*chanConn).Bytes())
+ }
+ })
+}
+
// Regression: the player-file classifier must canonicalize repeated "/" and
// "data/" prefixes so a raw-editor path cannot dodge the online check.
func TestPlayerDataFileNameCanonicalizesPrefixes(t *testing.T) {