Skip to content

Commit 5f07a9a

Browse files
committed
Tests: enable warnings for wrong card texts in WAR set
1 parent cf02b84 commit 5f07a9a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java

+17-9
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ private void checkAll(Card card, JsonCard ref) {
602602
//checkNumbers(card, ref); // TODO: load data from allsets.json and check it (allcards.json do not have card numbers)
603603
checkBasicLands(card, ref);
604604
checkMissingAbilities(card, ref);
605-
//checkWrongCosts(card, ref);
605+
checkWrongAbilitiesText(card, ref);
606606
}
607607

608608
private void checkColors(Card card, JsonCard ref) {
@@ -734,13 +734,23 @@ public void showCardInfo() throws Exception {
734734
card.getRules().stream().forEach(System.out::println);
735735
}
736736

737-
private void checkWrongCosts(Card card, JsonCard ref) {
738-
// checks missing or wrong cost
739-
if (!card.getExpansionSetCode().equals("RNA")) {
737+
private void checkWrongAbilitiesText(Card card, JsonCard ref) {
738+
// checks missing or wrong text
739+
if (!card.getExpansionSetCode().equals("WAR")) {
740740
return;
741741
}
742742

743-
String[] refRules = ref.text.split("[\\$\\\n]"); // ref card's abilities can be splited by \n or $ chars
743+
if (ref.text == null || ref.text.isEmpty()) {
744+
return;
745+
}
746+
747+
String refText = ref.text;
748+
// lands fix
749+
if (refText.startsWith("(") && refText.endsWith(")")) {
750+
refText = refText.substring(1, refText.length() - 1);
751+
}
752+
753+
String[] refRules = refText.split("[\\$\\\n]"); // ref card's abilities can be splited by \n or $ chars
744754
for (int i = 0; i < refRules.length; i++) {
745755
refRules[i] = prepareRule(card.getName(), refRules[i]);
746756
}
@@ -752,17 +762,15 @@ private void checkWrongCosts(Card card, JsonCard ref) {
752762

753763
for (String cardRule : cardRules) {
754764
boolean isAbilityFounded = false;
755-
boolean isCostOk = false;
756765
for (String refRule : refRules) {
757766
if (cardRule.equals(refRule)) {
758767
isAbilityFounded = true;
759-
isCostOk = true;
760768
break;
761769
}
762770
}
763771

764-
if (!isCostOk) {
765-
fail(card, "abilities", "card ability have cost, but can't find in ref [" + "xxx" + ": " + card.getRules() + "]");
772+
if (!isAbilityFounded) {
773+
warn(card, "card ability can't be found in ref [" + card.getName() + ": " + cardRule + "]");
766774
}
767775
}
768776
}

0 commit comments

Comments
 (0)