mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 04:29:31 +00:00
ICU-8557 Skipping a couple of spoof checker test cases on IBM Java 5 because of UTF-8 converter bug in the version.
X-SVN-Rev: 30090
This commit is contained in:
parent
af4be08b65
commit
0290110513
2 changed files with 43 additions and 1 deletions
|
@ -17,6 +17,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.dev.test.TestUtil;
|
||||
import com.ibm.icu.dev.test.TestUtil.JavaVendor;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.text.Normalizer2;
|
||||
import com.ibm.icu.text.SpoofChecker;
|
||||
|
@ -100,6 +101,11 @@ public class SpoofCheckerTest extends TestFmwk {
|
|||
* Test build from source rules.
|
||||
*/
|
||||
public void TestOpenFromSourceRules() {
|
||||
if (TestUtil.getJavaVendor() == JavaVendor.IBM && TestUtil.getJavaVersion() == 5) {
|
||||
// Note: IBM Java 5 has a bug reading a large UTF-8 text contents
|
||||
logln("Skip this test case because of the IBM Java 5 bug");
|
||||
return;
|
||||
}
|
||||
setup();
|
||||
String fileName;
|
||||
Reader confusables;
|
||||
|
@ -501,6 +507,11 @@ public class SpoofCheckerTest extends TestFmwk {
|
|||
// Verify that each item from the Unicode confusables.txt file
|
||||
// transforms into the expected skeleton.
|
||||
public void testConfData() {
|
||||
if (TestUtil.getJavaVendor() == JavaVendor.IBM && TestUtil.getJavaVersion() == 5) {
|
||||
// Note: IBM Java 5 has a bug reading a large UTF-8 text contents
|
||||
logln("Skip this test case because of the IBM Java 5 bug");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Read in the confusables.txt file. (Distributed by Unicode.org)
|
||||
String fileName = "unicode/confusables.txt";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -12,6 +12,7 @@ import java.io.FileInputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Locale;
|
||||
|
||||
public final class TestUtil {
|
||||
/**
|
||||
|
@ -208,4 +209,34 @@ public final class TestUtil {
|
|||
4*1024);
|
||||
}
|
||||
|
||||
public enum JavaVendor {
|
||||
Unknown,
|
||||
Oracle,
|
||||
IBM
|
||||
}
|
||||
|
||||
public static JavaVendor getJavaVendor() {
|
||||
JavaVendor vendor = JavaVendor.Unknown;
|
||||
String javaVendorProp = System.getProperty("java.vendor", "").toLowerCase(Locale.US).trim();
|
||||
if (javaVendorProp.startsWith("ibm")) {
|
||||
vendor = JavaVendor.IBM;
|
||||
} else if (javaVendorProp.startsWith("sun") || javaVendorProp.startsWith("oracle")) {
|
||||
vendor = JavaVendor.Oracle;
|
||||
}
|
||||
return vendor;
|
||||
}
|
||||
|
||||
public static int getJavaVersion() {
|
||||
int ver = -1;
|
||||
String verstr = System.getProperty("java.version");
|
||||
if (verstr != null) {
|
||||
String[] numbers = verstr.split("\\.");
|
||||
try {
|
||||
ver = Integer.parseInt(numbers[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
ver = -1;
|
||||
}
|
||||
}
|
||||
return ver;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue