1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

I18NTest: using _en as reference, removed test failure as this test was downgraded to "report"

This commit is contained in:
Federico Fissore
2013-01-24 10:44:17 +01:00
parent 6f08b8eae1
commit c1ce89ee48
3 changed files with 2230 additions and 2123 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,15 +5,11 @@ import org.junit.Test;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import static org.junit.Assert.assertTrue;
public class I18NTest { public class I18NTest {
private Set<String> loadAllI18NKeys() throws IOException { private Set<String> loadReferenceI18NKeys() throws IOException {
Properties properties = new Properties(); Properties properties = new Properties();
for (File file : listPropertiesFiles()) { properties.putAll(loadProperties(new File(I18NTest.class.getResource("./Resources_en.properties").getFile())));
properties.putAll(loadProperties(file));
}
Set<String> keys = new HashSet<String>(); Set<String> keys = new HashSet<String>();
for (Object key : properties.keySet()) { for (Object key : properties.keySet()) {
keys.add(key.toString()); keys.add(key.toString());
@ -46,7 +42,7 @@ public class I18NTest {
@Test @Test
public void ensureEveryTranslationIsComplete() throws Exception { public void ensureEveryTranslationIsComplete() throws Exception {
Set<String> keys = loadAllI18NKeys(); Set<String> keys = loadReferenceI18NKeys();
Map<String, List<String>> missingTranslationsPerFile = new HashMap<String, List<String>>(); Map<String, List<String>> missingTranslationsPerFile = new HashMap<String, List<String>>();
@ -60,14 +56,17 @@ public class I18NTest {
} }
if (!missingTranslationsPerFile.isEmpty()) { if (!missingTranslationsPerFile.isEmpty()) {
for (Map.Entry<String, List<String>> entry : missingTranslationsPerFile.entrySet()) { List<String> filesWithIncompleteTranslations = new LinkedList<String>(missingTranslationsPerFile.keySet());
System.out.println("Following translations in file " + entry.getKey() + " are missing:"); Collections.sort(filesWithIncompleteTranslations);
for (String key : entry.getValue()) { System.out.println("Following files have missing translations:" + filesWithIncompleteTranslations);
for (String file : filesWithIncompleteTranslations) {
System.out.println("Following translations in file " + file + " are missing:");
for (String key : missingTranslationsPerFile.get(file)) {
System.out.println("==> '" + key.replaceAll("\n", "\\\\n").replaceAll(" ", "\\\\ ") + "'"); System.out.println("==> '" + key.replaceAll("\n", "\\\\n").replaceAll(" ", "\\\\ ") + "'");
} }
System.out.println(); System.out.println();
} }
assertTrue(false);
} }
} }