Skip to content

Commit

Permalink
CLDR-17756 first cut at test for missing examples (#3835)
Browse files Browse the repository at this point in the history
  • Loading branch information
macchiati authored Jul 11, 2024
1 parent 2dd4e08 commit 9af283d
Show file tree
Hide file tree
Showing 2 changed files with 452 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ public void TestShowRowAction() {

for (String locale : localesForRowAction) {
DummyPathValueInfo dummyPathValueInfo = new DummyPathValueInfo();
dummyPathValueInfo.locale = CLDRLocale.getInstance(locale);
dummyPathValueInfo.setLocale(CLDRLocale.getInstance(locale));
CLDRFile cldrFile = testInfo.getCldrFactory().make(locale, true);
CLDRFile cldrFileUnresolved = testInfo.getCldrFactory().make(locale, false);

Expand All @@ -1107,8 +1107,9 @@ public void TestShowRowAction() {
for (PathHeader ph : sorted) {
String path = ph.getOriginalPath();
SurveyToolStatus surveyToolStatus = ph.getSurveyToolStatus();
dummyPathValueInfo.xpath = path;
dummyPathValueInfo.baselineValue = cldrFileUnresolved.getStringValue(path);
dummyPathValueInfo.setXpath(path);
dummyPathValueInfo.setBaselineValue(
cldrFileUnresolved.getStringValue(path));
StatusAction action =
phase.getShowRowAction(
dummyPathValueInfo, InputMethod.DIRECT, ph, dummyUserInfo);
Expand All @@ -1126,7 +1127,7 @@ public void TestShowRowAction() {
"vo ==> FORBID_READONLY",
StatusAction.FORBID_READONLY,
action);
} else if (dummyPathValueInfo.baselineValue == null) {
} else if (dummyPathValueInfo.getBaselineValue() == null) {
if (!assertEquals(
"missing ==> ALLOW", StatusAction.ALLOW, action)) {
warnln("\t\t" + locale + "\t" + ph);
Expand All @@ -1150,7 +1151,9 @@ public void TestShowRowAction() {
}
actionToExamplePath.put(
key,
Pair.of(dummyPathValueInfo.baselineValue != null, path));
Pair.of(
dummyPathValueInfo.getBaselineValue() != null,
path));
}
}
}
Expand Down Expand Up @@ -1210,7 +1213,7 @@ public VoterInfo getVoterInfo() {
}
};

private static class DummyPathValueInfo implements PathValueInfo {
public static class DummyPathValueInfo implements PathValueInfo {
private CLDRLocale locale;
private String xpath;
private String baselineValue;
Expand Down Expand Up @@ -1271,6 +1274,18 @@ public CLDRLocale getLocale() {
public String getXpath() {
return xpath;
}

public void setLocale(CLDRLocale locale) {
this.locale = locale;
}

public void setXpath(String xpath) {
this.xpath = xpath;
}

public void setBaselineValue(String baselineValue) {
this.baselineValue = baselineValue;
}
}

final Set<String> cldrLocales =
Expand Down
Loading

0 comments on commit 9af283d

Please sign in to comment.