verify test: fix false positives from mana ability adjustments (#11047)

This commit is contained in:
Susucre 2023-08-27 23:58:51 +02:00 committed by GitHub
parent a2162ec3e7
commit 7d34484362
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2373,7 +2373,15 @@ public class VerifyCardDataTest {
private String splitManaAbilities(String refText) { private String splitManaAbilities(String refText) {
for (String s : refText.split("[\\$\\\n]")) { for (String s : refText.split("[\\$\\\n]")) {
if (!Pattern.matches(".*: Add [^\\.]* or.*\\..*", s)) { if (!Pattern.matches("[^\"']*: Add [^\\.]* or.*\\..*", s)) {
continue;
}
// Loyalty Abilities
if (s.startsWith("0") || s.startsWith("+") || s.startsWith("-")) {
continue;
}
// Leafkin Avenger
if (s.contains("} for")) {
continue; continue;
} }
@ -2433,6 +2441,29 @@ public class VerifyCardDataTest {
"{T}: Add {B}. Activate only if you control a swamp.\n{T}: Add {U}. Activate only if you control a swamp.", "{T}: Add {B}. Activate only if you control a swamp.\n{T}: Add {U}. Activate only if you control a swamp.",
splitManaAbilities("{T}: Add {B} or {U}. Activate only if you control a swamp.") splitManaAbilities("{T}: Add {B} or {U}. Activate only if you control a swamp.")
); );
// Not splitting those:
Assert.assertEquals(
"{T}: Each player creates a colorless artifact token named Banana with \"{T}, Sacrifice this artifact: Add {R} or {G}. You gain 2 life.\"",
splitManaAbilities("{T}: Each player creates a colorless artifact token named Banana with \"{T}, Sacrifice this artifact: Add {R} or {G}. You gain 2 life.\"")
);
Assert.assertEquals(
"+1: Add {R} or {G}. Creature spells you cast this turn can't be countered.",
splitManaAbilities("+1: Add {R} or {G}. Creature spells you cast this turn can't be countered.")
);
Assert.assertEquals(
"0: Add {R} or {G}. Creature spells you cast this turn can't be countered.",
splitManaAbilities("0: Add {R} or {G}. Creature spells you cast this turn can't be countered.")
);
Assert.assertEquals(
"-1: Add {R} or {G}. Creature spells you cast this turn can't be countered.",
splitManaAbilities("-1: Add {R} or {G}. Creature spells you cast this turn can't be countered.")
);
Assert.assertEquals(
"{T}: Add {G} for each creature with power 4 or greater you control.",
splitManaAbilities("{T}: Add {G} for each creature with power 4 or greater you control.")
);
} }
private void checkTypes(Card card, MtgJsonCard ref) { private void checkTypes(Card card, MtgJsonCard ref) {