summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-06-15 11:24:51 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-06-15 11:24:51 -0700
commit476f42f709cca648bfa05598ac1b7191b839fa6c (patch)
treef86df89ead0974a64cc2d951a448c4f76f8ecc7d
parent4befccf601473fe84824cccec4e3664ef52bd064 (diff)
parenta9d779fa6375b2d4bce8d15f369773480b7c6b71 (diff)
downloadlibcore-476f42f709cca648bfa05598ac1b7191b839fa6c.zip
libcore-476f42f709cca648bfa05598ac1b7191b839fa6c.tar.gz
libcore-476f42f709cca648bfa05598ac1b7191b839fa6c.tar.bz2
Merge "Various broken tests." into dalvik-dev
-rw-r--r--expectations/brokentests.txt27
-rw-r--r--luni/src/main/java/com/ibm/icu4jni/lang/UCharacter.java6
-rw-r--r--luni/src/main/java/java/lang/Character.java20
-rw-r--r--luni/src/test/java/java/lang/CharacterTest.java34
4 files changed, 67 insertions, 20 deletions
diff --git a/expectations/brokentests.txt b/expectations/brokentests.txt
index 11a4dc5..d80dfb7 100644
--- a/expectations/brokentests.txt
+++ b/expectations/brokentests.txt
@@ -634,10 +634,6 @@ test org.apache.harmony.nio.tests.java.nio.channels.DatagramChannelTest#testRead
result EXEC_FAILED
pattern .*java.lang.IllegalArgumentException: read-only buffer.*
-# we don't cache canonical paths.
-test org.apache.harmony.luni.tests.java.io.FileCanonPathCacheTest
-result EXEC_FAILED
-
# ICU doesn't provide localized pattern characters, and these tests assume the locale they're using has them.
test org.apache.harmony.text.tests.java.text.SimpleDateFormatTest#test_applyLocalizedPatternLjava_lang_String
result EXEC_FAILED
@@ -685,3 +681,26 @@ result UNSUPPORTED
test java.util.ArrayList.IteratorMicroBenchmark
result UNSUPPORTED
+
+
+# This test is obsoleted by our java.lang.CharacterTest#test_valueOfC.
+test org.apache.harmony.luni.tests.java.lang.CharacterImplTest#test_valueOfC
+result EXEC_FAILED
+
+# The RI is still on Unicode 4.0, we're on 5.2, and Harmony is inconsistent
+# between its test for isJavaIdentifierPart(char) and isJavaIdentifierPart(int).
+test org.apache.harmony.luni.tests.java.lang.CharacterTest.test_isJavaIdentifierPartC
+result EXEC_FAILED
+
+
+# We removed this: we don't support Pack200.
+test org.apache.harmony.archive.tests.java.util.jar.Pack200Test
+result UNSUPPORTED
+
+# We removed this: we don't cache canonical paths.
+test org.apache.harmony.luni.tests.java.io.FileCanonPathCacheTest
+result UNSUPPORTED
+
+# We removed this: we don't throw NotYetImplementedException.
+test org.apache.harmony.luni.tests.util.NYITest
+result UNSUPPORTED
diff --git a/luni/src/main/java/com/ibm/icu4jni/lang/UCharacter.java b/luni/src/main/java/com/ibm/icu4jni/lang/UCharacter.java
index 2e06a53..d3c9be3 100644
--- a/luni/src/main/java/com/ibm/icu4jni/lang/UCharacter.java
+++ b/luni/src/main/java/com/ibm/icu4jni/lang/UCharacter.java
@@ -49,8 +49,10 @@ public final class UCharacter {
/**
* The indices of the entries of this table correspond with the value
* of the ICU enum UBlockCode. When updating ICU it's necessary
- * to check if there where any changes for the properties
- * used by java.lang.Character.
+ * to check if there were any changes for the properties
+ * used by java.lang.Character; realistically, ICU will offer new code
+ * blocks long before there's any corresponding public Java API.
+ *
* The enum is defined in common/unicode/uchar.h
*/
UnicodeBlock[] result = new UnicodeBlock[] { null,
diff --git a/luni/src/main/java/java/lang/Character.java b/luni/src/main/java/java/lang/Character.java
index 90082de..53b859d 100644
--- a/luni/src/main/java/java/lang/Character.java
+++ b/luni/src/main/java/java/lang/Character.java
@@ -17,27 +17,19 @@
package java.lang;
-import java.io.Serializable;
-// BEGIN android-removed
-// import java.util.SortedMap;
-// import java.util.TreeMap;
-//
-// import org.apache.harmony.luni.util.BinarySearch;
-// END android-removed
-
-// BEGIN android-changed
import com.ibm.icu4jni.lang.UCharacter;
-// END android-changed
+import java.io.Serializable;
/**
* The wrapper for the primitive type {@code char}. This class also provides a
* number of utility methods for working with characters.
- * <p>
- * Character data is based upon the Unicode Standard, 4.0. The Unicode
+ *
+ * <p>Character data is kept up to date as Unicode evolves.
+ * This implementation is currently based on Unicode 5.2. The Unicode
* specification, character tables and other information are available at <a
* href="http://www.unicode.org/">http://www.unicode.org/</a>.
- * <p>
- * Unicode characters are referred to as <i>code points</i>. The range of valid
+ *
+ * <p>Unicode characters are referred to as <i>code points</i>. The range of valid
* code points is U+0000 to U+10FFFF. The <i>Basic Multilingual Plane (BMP)</i>
* is the code point range U+0000 to U+FFFF. Characters above the BMP are
* referred to as <i>Supplementary Characters</i>. On the Java platform, UTF-16
diff --git a/luni/src/test/java/java/lang/CharacterTest.java b/luni/src/test/java/java/lang/CharacterTest.java
new file mode 100644
index 0000000..bad4797
--- /dev/null
+++ b/luni/src/test/java/java/lang/CharacterTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang;
+
+public class CharacterTest extends junit.framework.TestCase {
+ public void test_valueOfC() {
+ // The JLS requires caching for chars between "\u0000 to \u007f":
+ // http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7
+ // Harmony caches 0-512 and tests for this behavior, so we suppress that test and use this.
+ for (char c = '\u0000'; c <= '\u007f'; ++c) {
+ Character e = new Character(c);
+ Character a = Character.valueOf(c);
+ assertEquals(e, a);
+ assertSame(Character.valueOf(c), Character.valueOf(c));
+ }
+ for (int c = '\u0080'; c <= Character.MAX_VALUE; ++c) {
+ assertEquals(new Character((char) c), Character.valueOf((char) c));
+ }
+ }
+}