jdk/test/java/text/Format/NumberFormat/Bug8132125.java
author naoto
Mon, 03 Aug 2015 21:47:50 -0700
changeset 32015 eda394dcd1aa
child 40679 5378433ac23f
permissions -rw-r--r--
8129881: JDK-8008577 breaks Nashorn test 8130845: Change to CLDR Locale data in JDK 9 b71 causes SimpleDateFormat parsing errors 8132125: German (Switzerland) formatting broken if CLDR Locale Data is used Reviewed-by: tbell, okutsu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32015
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     1
/*
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     4
 *
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     7
 * published by the Free Software Foundation.
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     8
 *
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    13
 * accompanied this code).
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    14
 *
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    18
 *
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    21
 * questions.
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    22
 */
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    23
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    24
/*
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    25
 * @test
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    26
 * @bug 8132125
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    27
 * @summary Checks Swiss' number elements
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    28
 */
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    29
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    30
import java.text.*;
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    31
import java.util.*;
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    32
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    33
public class Bug8132125 {
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    34
    public static void main(String[] args) {
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    35
        Locale deCH = new Locale("de", "CH");
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    36
        NumberFormat nf = NumberFormat.getInstance(deCH);
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    37
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    38
        String expected = "54'839'483.142"; // i.e. "." as decimal separator, "'" as grouping separator
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    39
        String actual = nf.format(54839483.1415);
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    40
        if (!actual.equals(expected)) {
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    41
            throw new RuntimeException("correct for de_CH: " + expected + " vs. actual " + actual);
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    42
        }
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    43
    }
eda394dcd1aa 8129881: JDK-8008577 breaks Nashorn test
naoto
parents:
diff changeset
    44
}