test/jdk/java/text/BreakIterator/Bug8032446.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 31680 jdk/test/java/text/BreakIterator/Bug8032446.java@88c53c2293b4
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31680
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     1
/*
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     4
 *
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     7
 * published by the Free Software Foundation.
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     8
 *
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    13
 * accompanied this code).
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    14
 *
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    18
 *
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    21
 * questions.
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    22
 */
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    23
/*
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    24
 * @test
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    25
 * @bug 8032446
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    26
 * @summary Confirm that BreakIterator works as expected with new characters in Unicode 7.
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    27
 */
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    28
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    29
import java.text.*;
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    30
import java.util.*;
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    31
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    32
public class Bug8032446 {
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    33
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    34
    public static void main(String[] args) {
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    35
        boolean err = false;
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    36
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    37
        StringBuilder sb = new StringBuilder();
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    38
        for (int i = 0x10860; i <= 0x10876; i++) { // Palmyrene Letters
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    39
            sb.append(Character.toChars(i));
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    40
        }
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    41
        sb.append(" ");
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    42
        for (int i = 0x10879; i <= 0x1087D; i++) { // Palmyrene Numbers
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    43
            sb.append(Character.toChars(i));
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    44
        }
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    45
        String s = sb.toString();
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    46
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    47
        BreakIterator bi = BreakIterator.getWordInstance(Locale.ROOT);
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    48
        bi.setText(s);
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    49
        bi.first();
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    50
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    51
        if (bi.next() != s.indexOf(' ')) {
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    52
            throw new RuntimeException("Unexpected word breaking.");
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    53
        }
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    54
    }
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    55
88c53c2293b4 8032446: Support Unicode 7.0.0 in JDK 9
peytoia
parents:
diff changeset
    56
}