Skip to content

Commit

Permalink
Fix log string escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed Apr 4, 2024
1 parent c2e68a0 commit e231707
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 59 deletions.
2 changes: 1 addition & 1 deletion test/clj/game/cards/hardware_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3973,7 +3973,7 @@
(take-credits state :corp)
(play-from-hand state :runner "Prognostic Q-Loop")
(card-ability state :runner (get-hardware state 0) 1)
(is (last-log-contains? state "Runner spends \\[Click] and pays 1 \\[Credits] to install Prognostic Q-Loop.")
(is (last-log-contains? state "Runner spends [Click] and pays 1 [Credits] to install Prognostic Q-Loop.")
"Shouldn't print anything to log as the stack is empty")))

(deftest prognostic-q-loop-orders-correctly-with-other-on-run-triggers-when-firing-first-issue-4973
Expand Down
14 changes: 7 additions & 7 deletions test/clj/game/cards/ice_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
(is (changed? [(:credit (get-corp)) +1]
(card-ability state :runner cor 0)
(click-prompt state :runner "End the run")
(is (last-log-contains? state "Corp uses Bailiff to gain 1 \\[Credits\\]")
(is (last-log-contains? state "Corp uses Bailiff to gain 1 [Credits]")
"Correct message"))
"Gained 1c from subroutines being broken"))))

Expand Down Expand Up @@ -902,8 +902,8 @@
(is (changed? [(:credit (get-corp)) +2]
(auto-pump-and-break state cor))
"Gained 2c from the runner breaking")
(is (last-n-log-contains? state 2 "Corp uses Bailiff to gain 1 \\[Credits\\]"))
(is (last-n-log-contains? state 3 "Corp uses Bailiff to gain 1 \\[Credits\\]"))))))
(is (last-n-log-contains? state 2 "Corp uses Bailiff to gain 1 [Credits]"))
(is (last-n-log-contains? state 3 "Corp uses Bailiff to gain 1 [Credits]"))))))

(deftest ballista
;; Ballista
Expand Down Expand Up @@ -2874,7 +2874,7 @@
(card-ability state :runner cor 0)
(click-prompt state :runner "End the run unless the Runner pays 3 [Credits]")
(click-prompt state :runner "Done")
(is (last-log-contains? state "Corp uses Gold Farmer to force the runner to lose 1 \\[Credits\\] for breaking printed subs")
(is (last-log-contains? state "Corp uses Gold Farmer to force the runner to lose 1 [Credits] for breaking printed subs")
"Correct message"))
"Paid 1c + 1c for breaking"))))

Expand All @@ -2894,9 +2894,9 @@
(run-continue state)
(is (changed? [(:credit (get-runner)) -4]
(auto-pump-and-break state cor)
(is (last-n-log-contains? state 2 "Corp uses Gold Farmer to force the runner to lose 1 \\[Credits\\] for breaking printed subs")
(is (last-n-log-contains? state 2 "Corp uses Gold Farmer to force the runner to lose 1 [Credits] for breaking printed subs")
"Correct messages")
(is (last-n-log-contains? state 3 "Corp uses Gold Farmer to force the runner to lose 1 \\[Credits\\] for breaking printed subs")))
(is (last-n-log-contains? state 3 "Corp uses Gold Farmer to force the runner to lose 1 [Credits] for breaking printed subs")))
"Paid 2c + 2c for breaking"))))

(deftest gold-farmer-interaction-with-paperclip
Expand Down Expand Up @@ -6572,7 +6572,7 @@
(card-subroutine state :corp shiro 1)
(let [credits (:credit (get-corp))]
(click-prompt state :corp "Yes")
(is (last-log-contains? state "pays 1 \\[Credits\\]") "Payment is logged")
(is (last-log-contains? state "pays 1 [Credits]") "Payment is logged")
(is (last-log-contains? state "keep the Runner from breaching R&D") "Prevention is logged")
(is (= (dec credits) (:credit (get-corp))) "Corp pays 1 to prevent access"))))))

Expand Down
6 changes: 3 additions & 3 deletions test/clj/game/cards/identities_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@
(is (changed? [(:credit (get-runner)) -1]
(run-on state :hq))
"Paid 1c to run on HQ")
(is (last-log-contains? state "spends \\[Click\\] and pays 1 \\[Credits\\] to make a run on HQ") "Should have correct log with credits price for the run")))
(is (last-log-contains? state "spends [Click] and pays 1 [Credits] to make a run on HQ") "Should have correct log with credits price for the run")))

(deftest earth-station-sea-headquarters-front-side-flipping-costs-1-click
;; Flipping costs 1 click
Expand All @@ -1021,7 +1021,7 @@
(card-ability state :corp (get-in @state [:corp :identity]) 0))
"Paid 1 click to flip Earth Station")
(is (:flipped (get-in @state [:corp :identity])) "Earth Station is on flip side")
(is (last-log-contains? state "Corp spends \\[Click\\] to use Earth Station: SEA Headquarters to flip their identity to Earth Station: Ascending to Orbit.") "Should have correct log with click price")))
(is (last-log-contains? state "Corp spends [Click] to use Earth Station: SEA Headquarters to flip their identity to Earth Station: Ascending to Orbit.") "Should have correct log with click price")))

(deftest earth-station-sea-headquarters-flip-side-no-additional-cost-to-run-hq
;; No additional cost to run HQ
Expand Down Expand Up @@ -1056,7 +1056,7 @@
(is (changed? [(:credit (get-runner)) -6]
(run-on state :remote1))
"Paid 6c to run on remote server")
(is (last-log-contains? state "spends \\[Click\\] and pays 6 \\[Credits\\] to make a run on Server 1") "Should have correct log with credits price for the run")))
(is (last-log-contains? state "spends [Click] and pays 6 [Credits] to make a run on Server 1") "Should have correct log with credits price for the run")))

(deftest earth-station-sea-headquarters-flip-side-flip-back-on-successful-hq-run
;; Flip back on successful HQ run
Expand Down
14 changes: 7 additions & 7 deletions test/clj/game/cards/programs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@
(click-prompt state :runner "Yes")
(click-prompt state :runner "3"))
"Runner uses Bug")
(is (last-log-contains? state "Runner pays 6 \\[Credits] to use Bug to force the Corp to reveal they drew Hedge Fund, Hedge Fund, and Hedge Fund."))))
(is (last-log-contains? state "Runner pays 6 [Credits] to use Bug to force the Corp to reveal they drew Hedge Fund, Hedge Fund, and Hedge Fund."))))

(deftest buzzsaw
;; Buzzsaw
Expand Down Expand Up @@ -2882,15 +2882,15 @@
(rez state :corp (get-ice state :hq 0))
(run-continue state)
(auto-pump-and-break state (get-program state 0))
(is (second-last-log-contains? state "Runner pays 0 \\[Credits\\] to use Euler to break all 2 subroutines on Enigma.") "Correct log with correct cost")
(is (second-last-log-contains? state "Runner pays 0 [Credits] to use Euler to break all 2 subroutines on Enigma.") "Correct log with correct cost")
(core/continue state :corp nil)
(run-jack-out state)
(take-credits state :runner)
(take-credits state :corp)
(run-on state :hq)
(run-continue state)
(auto-pump-and-break state (get-program state 0))
(is (second-last-log-contains? state "Runner pays 2 \\[Credits\\] to use Euler to break all 2 subroutines on Enigma.") "Correct second log with correct cost")
(is (second-last-log-contains? state "Runner pays 2 [Credits] to use Euler to break all 2 subroutines on Enigma.") "Correct second log with correct cost")
(core/continue state :corp nil)))

(deftest expert-schedule-analyzer
Expand Down Expand Up @@ -4760,14 +4760,14 @@
(run-on state "HQ")
(run-continue state)
(auto-pump-and-break state (refresh maven))
(is (second-last-log-contains? state "Runner pays 4 \\[Credits\\] to use Maven to break all 2 subroutines on Border Control.") "Correct log with autopump ability")
(is (second-last-log-contains? state "Runner pays 4 [Credits] to use Maven to break all 2 subroutines on Border Control.") "Correct log with autopump ability")
(core/continue state :corp nil)
(run-jack-out state)
(run-on state "HQ")
(run-continue state)
(card-ability state :runner (refresh maven) 0)
(click-prompt state :runner "End the run")
(is (last-log-contains? state "Runner pays 2 \\[Credits\\] to use Maven to break 1 subroutine on Border Control.") "Correct log with single sub break"))))
(is (last-log-contains? state "Runner pays 2 [Credits] to use Maven to break 1 subroutine on Border Control.") "Correct log with single sub break"))))

(deftest mayfly
;; Mayfly
Expand Down Expand Up @@ -4827,7 +4827,7 @@
(run-on state "HQ")
(run-continue state)
(auto-pump-and-break state (refresh mimic))
(is (second-last-log-contains? state "Runner pays 2 \\[Credits\\] to use Mimic to break all 2 subroutines on Pup") "Correct log with autopump ability")
(is (second-last-log-contains? state "Runner pays 2 [Credits] to use Mimic to break all 2 subroutines on Pup") "Correct log with autopump ability")
(core/continue state :corp nil)
(run-jack-out state)
(is (zero? (:credit (get-runner))) "Runner spent 2 credits to break Pup")
Expand Down Expand Up @@ -4869,7 +4869,7 @@
(run-continue state)
(is (= 2 (count (:abilities (refresh mimic)))) "Auto pump and break ability on Mimic is available")
(auto-pump-and-break state (refresh mimic))
(is (second-last-log-contains? state "Runner pays 3 \\[Credits\\] to use Mimic to break all 3 subroutines on Zed 2.0") "Correct log with autopump ability")
(is (second-last-log-contains? state "Runner pays 3 [Credits] to use Mimic to break all 3 subroutines on Zed 2.0") "Correct log with autopump ability")
(core/continue state :corp nil)
(run-jack-out state)
(is (= 1 (:credit (get-runner))) "Runner spent 3 credits to break Zed 2.0"))))
Expand Down
30 changes: 15 additions & 15 deletions test/clj/game/cards/resources_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1379,10 +1379,10 @@
(take-credits state :corp)
(play-from-hand state :runner "Dadiana Chacon")
(play-from-hand state :runner "Corroder")
(is (last-n-log-contains? state 3 "Runner spends \\[Click\\] and pays 0 \\[Credits\\] to install Dadiana Chacon."))
(is (last-n-log-contains? state 3 "Runner spends [Click] and pays 0 [Credits] to install Dadiana Chacon."))
(is (last-n-log-contains? state 2 "Runner uses Dadiana Chacon to suffer 3 meat damage."))
(is (second-last-log-contains? state "Runner trashes Corroder, Corroder, and Corroder due to meat damage."))
(is (last-log-contains? state "Runner spends \\[Click\\] and pays 2 \\[Credits\\] to install Corroder."))))
(is (last-log-contains? state "Runner spends [Click] and pays 2 [Credits] to install Corroder."))))

(deftest daeg-first-net-cat
;; Daeg, First Net-Cat - charge on score/steal
Expand Down Expand Up @@ -3874,7 +3874,7 @@
(is (zero? (:click (get-runner))) "Should now have 0 clicks")
(is (= 1 (count (:discard (get-runner)))) "Logic Bomb should be discarded")
(is (last-log-contains? state "use Logic Bomb"))
(is (last-log-contains? state "\\[Click\\]\\[Click\\]") "Log should mention 2 clicks")))
(is (last-log-contains? state "[Click][Click]") "Log should mention 2 clicks")))

(deftest logic-bomb-if-the-runner-has-no-clicks-left
;; if the runner has no clicks left
Expand All @@ -3894,7 +3894,7 @@
(is (zero? (:click (get-runner))) "Should still have 0 clicks")
(is (= 1 (count (:discard (get-runner)))) "Logic Bomb should be discarded")
(is (last-log-contains? state "use Logic Bomb"))
(is (not (last-log-contains? state "\\[Click\\]")) "Log shouldn't mention any clicks")))
(is (not (last-log-contains? state "[Click]")) "Log shouldn't mention any clicks")))

(deftest london-library
;; Install non-virus programs on London library. Includes #325/409
Expand Down Expand Up @@ -4520,7 +4520,7 @@
(is (changed? [(:credit (get-runner)) -1]
(play-from-hand state :runner "Order of Sol"))
"Only spends 1 credit total to install Order of Sol")
(is (last-log-contains? state "Runner uses Order of Sol to gain 1 \\[Credits]."))))
(is (last-log-contains? state "Runner uses Order of Sol to gain 1 [Credits]."))))

(deftest order-of-sol-get-down-to-zero-credits-from-playing-an-event
;; Get down to zero credits from playing an event
Expand All @@ -4532,7 +4532,7 @@
(is (changed? [(:credit (get-runner)) 5]
(play-from-hand state :runner "Sure Gamble"))
"Gain 5 total credits from playing Sure Gamble")
(is (last-n-log-contains? state 2 "Runner uses Order of Sol to gain 1 \\[Credits]."))))
(is (last-n-log-contains? state 2 "Runner uses Order of Sol to gain 1 [Credits]."))))

(deftest order-of-sol-losing-credits
;; Losing credits
Expand All @@ -4548,7 +4548,7 @@
(is (changed? [(:credit (get-runner)) 0]
(rez state :corp (get-content state :remote1 0)))
"Gain and lose 1 credit")
(is (last-log-contains? state "Runner uses Order of Sol to gain 1 \\[Credits]."))))
(is (last-log-contains? state "Runner uses Order of Sol to gain 1 [Credits]."))))

(deftest pad-tap
;; PAD Tap
Expand Down Expand Up @@ -4822,21 +4822,21 @@
(is (changed? [(:credit (get-runner)) -4]
(click-card state :runner mo))
"Pay 4 for MOpus install (1+5-2)")
(is (second-last-log-contains? state "Runner pays 1 \\[Credits\\] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 3 \\[Credits\\] to install Magnum Opus using Paule's Café\\.") "Correct message for MOpus install")
(is (second-last-log-contains? state "Runner pays 1 [Credits] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 3 [Credits] to install Magnum Opus using Paule's Café\\.") "Correct message for MOpus install")
(card-ability state :runner pau 1)
(is (changed? [(:credit (get-runner)) -4]
(click-card state :runner des))
"Pay 4 for Desperado install (1+3)")
(is (second-last-log-contains? state "Runner pays 1 \\[Credits\\] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 3 \\[Credits\\] to install Desperado using Paule's Café\\.") "Correct message for Desperado install")
(is (second-last-log-contains? state "Runner pays 1 [Credits] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 3 [Credits] to install Desperado using Paule's Café\\.") "Correct message for Desperado install")
(take-credits state :runner)
(card-ability state :runner pau 1)
(is (changed? [(:credit (get-runner)) -3]
(click-card state :runner cor))
"Pay 3 for Corroder install in Corp turn (1+2)")
(is (second-last-log-contains? state "Runner pays 1 \\[Credits\\] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 2 \\[Credits\\] to install Corroder using Paule's Café\\.") "Correct message for Corroder install")))))
(is (second-last-log-contains? state "Runner pays 1 [Credits] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 2 [Credits] to install Corroder using Paule's Café\\.") "Correct message for Corroder install")))))

(deftest paule-s-cafe-can-t-lower-cost-below-1-issue-4816
;; Can't lower cost below 1. Issue #4816
Expand All @@ -4858,8 +4858,8 @@
(card-ability state :runner pau 1)
(click-card state :runner cor))
"Pay 1 credit for Corroder (2 - 4 + 1 base)")
(is (second-last-log-contains? state "Runner pays 1 \\[Credits\\] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 0 \\[Credits\\] to install Corroder using Paule's Café\\.") "Correct message for Corroder install")))))
(is (second-last-log-contains? state "Runner pays 1 [Credits] to use Paule's Café to install hosted card\\.") "Correct message for Paule usage")
(is (last-log-contains? state "Runner pays 0 [Credits] to install Corroder using Paule's Café\\.") "Correct message for Corroder install")))))

(deftest penumbral-toolkit-install-cost-reduction-after-hq-run
;; install cost reduction after HQ run
Expand Down
4 changes: 2 additions & 2 deletions test/clj/game/cards/upgrades_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,8 @@
(take-credits state :corp)
(play-from-hand state :runner "Dirty Laundry")
(click-prompt state :runner "HQ")
(is (second-last-log-contains? state "Runner spends \\[Click\\] and pays 2 \\[Credits\\] to play Dirty Laundry."))
(is (last-log-contains? state "Runner spends \\[Click\\] and pays 1 \\[Credits\\] to make a run on HQ."))))
(is (second-last-log-contains? state "Runner spends [Click] and pays 2 [Credits] to play Dirty Laundry."))
(is (last-log-contains? state "Runner spends [Click] and pays 1 [Credits] to make a run on HQ."))))

(deftest corporate-troubleshooter
;; Corporate Troubleshooter - Pay X credits and trash to add X strength to a piece of rezzed ice
Expand Down
4 changes: 2 additions & 2 deletions test/clj/game/core/actions_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
(run-continue state)
(card-side-ability state :runner ice 0)
(click-prompt state :runner "End the run")
(is (last-log-contains? state "Runner loses \\[Click\\] to use Eli 1.0 to break 1 subroutine on Eli 1.0"))
(is (last-log-contains? state "Runner loses [Click] to use Eli 1.0 to break 1 subroutine on Eli 1.0"))
(click-prompt state :runner "End the run")
(is (last-log-contains? state "Runner loses \\[Click\\] to use Eli 1.0 to break 1 subroutine on Eli 1.0")))
(is (last-log-contains? state "Runner loses [Click] to use Eli 1.0 to break 1 subroutine on Eli 1.0")))
(run-continue state)
(run-continue state)
(click-prompt state :runner "No action")
Expand Down
Loading

0 comments on commit e231707

Please sign in to comment.