ICU-4451 improve API/code coverage
X-SVN-Rev: 18162
This commit is contained in:
parent
9bd04314d0
commit
34d451e3b1
@ -15,11 +15,12 @@
|
||||
<taskdef resource="clovertasks"/>
|
||||
|
||||
<target name="with.clover">
|
||||
<mkdir dir="tmp/"/>
|
||||
<clover-setup initString="tmp/icu4j.db">
|
||||
<files>
|
||||
<exclude name="**/dev/**/*.java"/>
|
||||
</files>
|
||||
<methodContext id="API" regexp="(.* )?public .*"/>
|
||||
<methodContext name="API" regexp="(.* )?public .*"/>
|
||||
</clover-setup>
|
||||
</target>
|
||||
|
||||
@ -38,17 +39,11 @@
|
||||
</clover-report>
|
||||
</target>
|
||||
<target name="clover.log" depends="with.clover">
|
||||
<clover-log level="method">
|
||||
<clover-log level="method" filter="private">
|
||||
<package name="com.ibm.icu.text"/>
|
||||
</clover-log>
|
||||
<clover-log level="method">
|
||||
<package name="com.ibm.icu.lang"/>
|
||||
</clover-log>
|
||||
<clover-log level="method">
|
||||
<package name="com.ibm.icu.math"/>
|
||||
</clover-log>
|
||||
<clover-log level="method">
|
||||
<package name="com.ibm.icu.util"/>
|
||||
<package name="com.ibm.icu.util"/>
|
||||
</clover-log>
|
||||
</target>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2005, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -36,7 +36,8 @@ public class TestAll extends TestGroup {
|
||||
"com.ibm.icu.dev.test.bigdec.DiagBigDecimal", // not a group
|
||||
"com.ibm.icu.dev.test.impl.TestAll",
|
||||
"com.ibm.icu.dev.test.stringprep.TestAll",
|
||||
"com.ibm.icu.dev.test.timescale.TestAll"
|
||||
"com.ibm.icu.dev.test.timescale.TestAll",
|
||||
"com.ibm.icu.dev.test.charsetdet.TestCharsetDetector"
|
||||
},
|
||||
"All tests in ICU");
|
||||
}
|
||||
|
@ -181,6 +181,10 @@ public class TestCharsetDetector extends TestFmwk
|
||||
CharsetMatch m;
|
||||
|
||||
det.enableInputFilter(true);
|
||||
if (!det.inputFilterEnabled()){
|
||||
errln("input filter should be enabled");
|
||||
}
|
||||
|
||||
det.setText(bytes);
|
||||
m = det.detect();
|
||||
|
||||
@ -213,6 +217,7 @@ public class TestCharsetDetector extends TestFmwk
|
||||
|
||||
reader = det.getReader(new ByteArrayInputStream(bytes), "UTF-8");
|
||||
CheckAssert(s.equals(stringFromReader(reader)));
|
||||
det.setDeclaredEncoding("UTF-8"); // Jitterbug 4451, for coverage
|
||||
}
|
||||
|
||||
public void TestUTF16() throws Exception
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************************
|
||||
*
|
||||
* Copyright (C) 1996-2004, International Business Machines
|
||||
* Copyright (C) 1996-2005, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**/
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
package com.ibm.icu.dev.test.format;
|
||||
|
||||
import com.ibm.icu.text.*;
|
||||
import com.ibm.icu.util.Currency;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class IntlTestDecimalFormatSymbols extends com.ibm.icu.dev.test.TestFmwk
|
||||
@ -45,6 +47,18 @@ public class IntlTestDecimalFormatSymbols extends com.ibm.icu.dev.test.TestFmwk
|
||||
errln("ERROR: get/set ZeroDigit failed");
|
||||
}
|
||||
|
||||
char sigDigit = en.getSignificantDigit();
|
||||
fr.setZeroDigit(sigDigit);
|
||||
if(fr.getSignificantDigit() != en.getSignificantDigit()) {
|
||||
errln("ERROR: get/set SignificantDigit failed");
|
||||
}
|
||||
|
||||
Currency currency = Currency.getInstance("USD");
|
||||
fr.setCurrency(currency);
|
||||
if (!fr.getCurrency().equals(currency)){
|
||||
errln("ERROR: get/set Currency failed");
|
||||
}
|
||||
|
||||
char group = en.getGroupingSeparator();
|
||||
fr.setGroupingSeparator(group);
|
||||
if(fr.getGroupingSeparator() != en.getGroupingSeparator()) {
|
||||
|
@ -2307,6 +2307,26 @@ public final class UCharacterTest extends TestFmwk
|
||||
assertEquals("UCharacter.forDigit ", "7", String.valueOf(ch1));
|
||||
char ch2 = UCharacter.forDigit(17, 20);
|
||||
assertEquals("UCharacter.forDigit ", "h", String.valueOf(ch2));
|
||||
|
||||
//Jitterbug 4451, for coverage
|
||||
for (int i = 0x0041; i < 0x005B; i++) {
|
||||
if (!UCharacter.isJavaLetter(i))
|
||||
errln("FAIL \\u" + hex(i) + " expected to be a letter");
|
||||
if (!UCharacter.isJavaIdentifierStart(i))
|
||||
errln("FAIL \\u" + hex(i) + " expected to be a Java identifier start character");
|
||||
if (!UCharacter.isJavaLetterOrDigit(i))
|
||||
errln("FAIL \\u" + hex(i) + " expected not to be a Java letter");
|
||||
if (!UCharacter.isJavaIdentifierPart(i))
|
||||
errln("FAIL \\u" + hex(i) + " expected to be a Java identifier part character");
|
||||
}
|
||||
char[] spaces = {'\t','\n','\f','\r',' '};
|
||||
for (int i = 0; i < spaces.length; i++){
|
||||
if (!UCharacter.isSpace(spaces[i]))
|
||||
errln("FAIL \\u" + hex(spaces[i]) + " expected to be a Java space");
|
||||
}
|
||||
if (!UCharacter.getStringPropertyValue(UProperty.AGE,'\u3400',0).equals("3.0.0.0")){
|
||||
errln("FAIL \\u3400 expected to be 3.0.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
public void TestCasePropsDummy() {
|
||||
|
@ -3082,7 +3082,7 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
|
||||
* @deprecated (Java)
|
||||
*/
|
||||
public static boolean isJavaLetterOrDigit(int cp) {
|
||||
return isJavaLetterOrDigit(cp);
|
||||
return isJavaIdentifierPart(cp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@ package com.ibm.icu.lang;
|
||||
public class UCharacterEnums {
|
||||
|
||||
/** This is just a namespace, it is not instantiatable. */
|
||||
///CLOVER:OFF
|
||||
private UCharacterEnums() {}
|
||||
|
||||
/**
|
||||
|
@ -1883,11 +1883,12 @@ public final class Normalizer implements Cloneable {
|
||||
* @deprecated ICU 3.2
|
||||
* @obsolete ICU 3.2
|
||||
*/
|
||||
///CLOVER:OFF
|
||||
public int setIndex(int index) {
|
||||
setIndexOnly(index);
|
||||
return current();
|
||||
}
|
||||
|
||||
///CLOVER:ON
|
||||
/**
|
||||
* Retrieve the index of the start of the input text. This is the begin
|
||||
* index of the <tt>CharacterIterator</tt> or the start (i.e. 0) of the
|
||||
|
@ -305,7 +305,7 @@ public class Currency extends MeasureUnit implements Serializable {
|
||||
* @deprecated This is a draft API and might change in a future release of ICU.
|
||||
*/
|
||||
public String getSymbol(ULocale uloc) {
|
||||
return getName(uloc, SYMBOL_NAME, null);
|
||||
return getName(uloc, SYMBOL_NAME, new boolean[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user