From: <otm...@us...> - 2007-06-28 22:33:22
|
Revision: 3276 http://svn.sourceforge.net/jython/?rev=3276&view=rev Author: otmarhumbel Date: 2007-06-28 15:33:21 -0700 (Thu, 28 Jun 2007) Log Message: ----------- avoid a JUnit test failure on systems with encodings other than Latin 1 Modified Paths: -------------- trunk/installer/test/java/org/python/util/install/UnicodeSequencesTest.java Modified: trunk/installer/test/java/org/python/util/install/UnicodeSequencesTest.java =================================================================== --- trunk/installer/test/java/org/python/util/install/UnicodeSequencesTest.java 2007-06-28 21:57:38 UTC (rev 3275) +++ trunk/installer/test/java/org/python/util/install/UnicodeSequencesTest.java 2007-06-28 22:33:21 UTC (rev 3276) @@ -1,16 +1,34 @@ package org.python.util.install; +import java.util.HashSet; +import java.util.Set; + import junit.framework.TestCase; public class UnicodeSequencesTest extends TestCase { - + + private static Set _latin1Encodings; + public void testUmlaute() { - assertEquals("\xE4", UnicodeSequences.a2); - assertEquals("\xC4", UnicodeSequences.A2); - assertEquals("\xF6", UnicodeSequences.o2); - assertEquals("\xD6", UnicodeSequences.O2); - assertEquals("\xFC", UnicodeSequences.u2); - assertEquals("\xDC", UnicodeSequences.U2); + String fileEncoding = System.getProperty("file.encoding", "unknown"); + if (getLatin1Encodings().contains(fileEncoding)) { + assertEquals("\xE4", UnicodeSequences.a2); + assertEquals("\xC4", UnicodeSequences.A2); + assertEquals("\xF6", UnicodeSequences.o2); + assertEquals("\xD6", UnicodeSequences.O2); + assertEquals("\xFC", UnicodeSequences.u2); + assertEquals("\xDC", UnicodeSequences.U2); + } } + private static Set getLatin1Encodings() { + if (_latin1Encodings == null) { + _latin1Encodings = new HashSet(3); + _latin1Encodings.add("ISO-LATIN-1"); + _latin1Encodings.add("ISO-8859-1"); + _latin1Encodings.add("Cp1252"); + } + return _latin1Encodings; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |