From 2de535feb2ff8620ddb097a8b9f8c262c3e384b4 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 30 Jun 2019 22:48:36 +0400 Subject: [PATCH] Tests: improved verify checks for missing/wrong abilities --- .../java/mage/verify/VerifyCardDataTest.java | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index b045559feecd..d6ba12acdf72 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -728,12 +728,15 @@ private String prepareRule(String cardName, String rule) { String newRule = rule; // remove reminder text - newRule = newRule.replaceAll("(?i)\\(.+\\)", ""); + newRule = newRule.replaceAll("(?i) \\(.+\\)", ""); + newRule = newRule.replaceAll("(?i) \\(.+\\)", ""); // replace special text and symbols newRule = newRule .replace("{this}", cardName) - .replace("—", "—"); + .replace("{source}", cardName) + .replace("−", "-") + .replace("—", "-"); // remove html marks newRule = newRule @@ -757,7 +760,7 @@ public void showCardInfo() throws Exception { private void checkWrongAbilitiesText(Card card, JsonCard ref) { // checks missing or wrong text - if (!card.getExpansionSetCode().equals("MH1")) { + if (!card.getExpansionSetCode().equals("M20")) { return; } @@ -781,6 +784,7 @@ private void checkWrongAbilitiesText(Card card, JsonCard ref) { cardRules[i] = prepareRule(card.getName(), cardRules[i]); } + boolean isFine = true; for (String cardRule : cardRules) { boolean isAbilityFounded = false; for (String refRule : refRules) { @@ -791,9 +795,29 @@ private void checkWrongAbilitiesText(Card card, JsonCard ref) { } if (!isAbilityFounded) { + isFine = false; warn(card, "card ability can't be found in ref [" + card.getName() + ": " + cardRule + "]"); } } + + // extra message for easy checks + if (!isFine) { + System.out.println(); + + System.out.println("Wrong card " + card.getName()); + Arrays.sort(cardRules); + for (String s : cardRules) { + System.out.println(s); + } + + System.out.println("ref:"); + Arrays.sort(refRules); + for (String s : refRules) { + System.out.println(s); + } + + System.out.println(); + } }