1adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpackage org.apache.harmony.regex.tests.java.util.regex;
2adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
3adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectimport junit.framework.TestCase;
4adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectimport java.util.regex.*;
5adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
6adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project/**
7adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * TODO Type description
8f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes *
9adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */
10adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpublic class SplitTest extends TestCase {
11adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    public void testSimple() {
12adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        Pattern p = Pattern.compile("/");
13adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        String[] results = p.split("have/you/done/it/right");
14adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        String[] expected = new String[] { "have", "you", "done", "it", "right" };
1551809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(expected, results);
1651809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes    }
1751809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes
1825ebaa052bae22bd658de5ca71b431f4e16ce910Andreas Gampe    @SuppressWarnings("InvalidPatternSyntax")
1951809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes    public void testEmptySplits() {
2051809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // Trailing empty matches are removed.
2151809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[0], "hello".split("."));
2251809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "1", "2" }, "1:2:".split(":"));
2351809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // ...including when that results in an empty result.
2451809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[0], ":".split(":"));
2551809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // ...but not when limit < 0.
2651809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "1", "2", "" }, "1:2:".split(":", -1));
27f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
2851809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // Leading empty matches are retained.
2951809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "", "", "o" }, "hello".split(".."));
30f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
3151809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // A separator that doesn't occur in the input gets you the input.
3251809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "hello" }, "hello".split("not-present-in-test"));
3351809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // ...including when the input is the empty string.
3451809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // (Perl returns an empty list instead.)
3551809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "" }, "".split("not-present-in-test"));
3651809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "" }, "".split("A?"));
37f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
3851809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // The limit argument controls the size of the result.
3951809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // If l == 0, the result is as long as needed, except trailing empty matches are dropped.
4051809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // If l < 0, the result is as long as needed, and trailing empty matches are retained.
4151809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // If l > 0, the result contains the first l matches, plus one string containing the remaining input.
4251809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // Examples without a trailing separator (and hence without a trailing empty match):
4351809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c".split(",", 0));
4451809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a,b,c" }, "a,b,c".split(",", 1));
4551809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b,c" }, "a,b,c".split(",", 2));
4651809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c".split(",", 3));
4751809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c".split(",", Integer.MAX_VALUE));
4851809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        // Examples with a trailing separator (and hence possibly with a trailing empty match):
4951809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c" }, "a,b,c,".split(",", 0));
5051809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a,b,c," }, "a,b,c,".split(",", 1));
5151809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b,c," }, "a,b,c,".split(",", 2));
5251809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c," }, "a,b,c,".split(",", 3));
5351809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c", "" }, "a,b,c,".split(",", Integer.MAX_VALUE));
5451809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertArraysEqual(new String[] { "a", "b", "c", "" }, "a,b,c,".split(",", -1));
5551809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes    }
56f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
5751809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes    private void assertArraysEqual(String[] expected, String[] actual) {
5851809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes        assertEquals(expected.length, actual.length);
59adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        for (int i = 0; i < expected.length; i++) {
6051809b9c7995d8b813f68712b096d23179de3af0Elliott Hughes            assertEquals(Integer.toString(i), expected[i], actual[i]);
61adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        }
62adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    }
63f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
64adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    public void testSplit1() throws PatternSyntaxException {
65adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        Pattern p = Pattern.compile(" ");
66adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
67adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        String input = "poodle zoo";
68adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        String tokens[];
69adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
70adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 1);
71adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(1, tokens.length);
72adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[0].equals(input));
73adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 2);
74adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
75adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poodle", tokens[0]);
76adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("zoo", tokens[1]);
77adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 5);
78adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
79adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poodle", tokens[0]);
80adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("zoo", tokens[1]);
81adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, -2);
82adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
83adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poodle", tokens[0]);
84adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("zoo", tokens[1]);
85adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 0);
86adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
87adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poodle", tokens[0]);
88adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("zoo", tokens[1]);
89adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input);
90adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
91adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poodle", tokens[0]);
92adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("zoo", tokens[1]);
93adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
94adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        p = Pattern.compile("d");
95adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
96adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 1);
97adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(1, tokens.length);
98adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[0].equals(input));
99adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 2);
100adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
101adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poo", tokens[0]);
102adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("le zoo", tokens[1]);
103adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 5);
104adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
105adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poo", tokens[0]);
106adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("le zoo", tokens[1]);
107adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, -2);
108adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
109adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poo", tokens[0]);
110adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("le zoo", tokens[1]);
111adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 0);
112adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
113adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poo", tokens[0]);
114adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("le zoo", tokens[1]);
115adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input);
116adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
117adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("poo", tokens[0]);
118adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("le zoo", tokens[1]);
119adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
120adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        p = Pattern.compile("o");
121adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
122adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 1);
123adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(1, tokens.length);
124adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[0].equals(input));
125adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 2);
126adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(2, tokens.length);
127adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("p", tokens[0]);
128adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("odle zoo", tokens[1]);
129adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 5);
130adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(5, tokens.length);
131adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("p", tokens[0]);
132adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[1].equals(""));
133adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("dle z", tokens[2]);
134adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[3].equals(""));
135adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[4].equals(""));
136adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, -2);
137adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(5, tokens.length);
138adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("p", tokens[0]);
139adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[1].equals(""));
140adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("dle z", tokens[2]);
141adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[3].equals(""));
142adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[4].equals(""));
143adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input, 0);
144adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(3, tokens.length);
145adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("p", tokens[0]);
146adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[1].equals(""));
147adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("dle z", tokens[2]);
148adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        tokens = p.split(input);
149adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(3, tokens.length);
150adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("p", tokens[0]);
151adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertTrue(tokens[1].equals(""));
152adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("dle z", tokens[2]);
153adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    }
154adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
155adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    public void testSplit2() {
156adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        Pattern p = Pattern.compile("");
157adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        String s[];
158adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        s = p.split("a", -1);
159adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(3, s.length);
160adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("", s[0]);
161adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("a", s[1]);
162adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("", s[2]);
163adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
164adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        s = p.split("", -1);
165adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(1, s.length);
166adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("", s[0]);
167adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
168adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        s = p.split("abcd", -1);
169adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(6, s.length);
170adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("", s[0]);
171adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("a", s[1]);
172adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("b", s[2]);
173adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("c", s[3]);
174adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("d", s[4]);
175adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("", s[5]);
176f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
177adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        // Regression test for Android
178adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("GOOG,23,500".split("|").length, 12);
179adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    }
180adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
181adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project
182adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    public void testSplitSupplementaryWithEmptyString() {
183f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes
184adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        /*
185adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project         * See http://www.unicode.org/reports/tr18/#Supplementary_Characters
186adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project         * We have to treat text as code points not code units.
187adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project         */
188adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        Pattern p = Pattern.compile("");
189adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        String s[];
190adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        s = p.split("a\ud869\uded6b", -1);
191adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals(5, s.length);
192adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("", s[0]);
193adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("a", s[1]);
194adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project        assertEquals("\ud869\uded6", s[2]);
195f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes        assertEquals("b", s[3]);
196f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes        assertEquals("", s[4]);
197adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project    }
198adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project}
199