test/jdk/sun/nio/cs/TestISO2022JP.java
changeset 52378 fb71a4bc010d
parent 47216 71c04702a3d5
equal deleted inserted replaced
52377:907fdbbdf584 52378:fb71a4bc010d
     1 /*
     1 /*
     2  * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /* @test
    24 /* @test
    25  * @bug 4626545 4879522 4913711 4119445 8042125
    25  * @bug 4626545 4879522 4913711 4119445 8042125 8211382
    26  * @summary Check full coverage encode/decode for ISO-2022-JP
    26  * @summary Check full coverage encode/decode for ISO-2022-JP
    27  * @modules jdk.charsets
    27  * @modules jdk.charsets
    28  */
    28  */
    29 
    29 
    30 /*
    30 /*
   645         };
   645         };
   646         String expectedStr = "\uffe2\u22a5\u221a\u222b\u2252\u2261\u2220\u2235\u2229\u222a";
   646         String expectedStr = "\uffe2\u22a5\u221a\u222b\u2252\u2261\u2220\u2235\u2229\u222a";
   647         if (!new String(encoded, "x-windows-iso2022jp").equals(expectedStr)) {
   647         if (!new String(encoded, "x-windows-iso2022jp").equals(expectedStr)) {
   648                throw new Exception("MSISO2022JP Decoder error");
   648                throw new Exception("MSISO2022JP Decoder error");
   649         }
   649         }
       
   650         // Test for 11 iso2022jp decoder
       
   651         encoded = new byte[] {
       
   652             (byte)0x1B, (byte)0x28, (byte)0x49, (byte)0x60,
       
   653             (byte)0x1B, (byte)0x28, (byte)0x42,
       
   654         };
       
   655         String unexpectedStr = "\uffa0";
       
   656         expectedStr = "\ufffd";
       
   657         if (new String(encoded, "ISO2022JP").equals(unexpectedStr)) {
       
   658                throw new Exception("ISO2022JP Decoder error: \\uFFA0");
       
   659         } else if (!new String(encoded, "ISO2022JP").equals(expectedStr)) {
       
   660                throw new Exception("ISO2022JP Decoder error: \\uFFFD");
       
   661         }
   650     }
   662     }
   651 }
   663 }