From de75c0aa34c7db47ddec1704e94fa05c54687705 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Tue, 17 Feb 2015 13:46:16 +0000 Subject: Fix handling of consecutive quotes in ChoiceFormat et al. Two consecutive single quotes ('') must be interpreted as an escaped single quite sequence. We were implementing it by simply keeping track of whether the last character was a single quote. This is insufficient for sequences of three or more quotes since we shouldn't emit ('') for an escape sequence of ('''). We'll have to keep track of the number of consecutive quotes we've seen in the input instead. This is a partial fix for the bug below. There appears to be another bug in MessageFormat itself in its handling of subpatterns. bug: 19011159 Change-Id: Ia71e5d8c1962356cabc265cf80ebc0a04ff84f17 --- .../org/apache/harmony/tests/java/text/ChoiceFormatTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'harmony-tests/src/test') diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java index 63232ae..d52e586 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/ChoiceFormatTest.java @@ -21,6 +21,7 @@ import java.text.ChoiceFormat; import java.text.FieldPosition; import java.text.MessageFormat; import java.text.ParsePosition; +import java.util.Locale; import junit.framework.TestCase; @@ -474,4 +475,15 @@ public class ChoiceFormatTest extends TestCase { assertEquals("-\u221E