1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.util.*;
25
26 /*
27 * @test
28 * @bug 8011194
29 * @summary Test value of file.encoding for corresponding value of LANG, etc
30 * @library ../../../../tools/launcher/ ../
31 * @build TestHelper TestFileEncoding ExpectedEncoding
32 * @run main TestFileEncoding UTF-8
33 * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding
34 * @run main TestFileEncoding UTF-8 en_US.UTF-8
35 * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding en_US.UTF-8
36 * @run main TestFileEncoding US-ASCII C
37 * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding C
38 * @author Brent Christian
39 */
40
41 /**
42 * Setup the environment and run a sub-test to check the expected value of
43 * file.encoding, based on the value(s) of encoding-related environment vars
44 * (LANG, LC_ALL, LC_CTYPE).
45 *
46 * The first argument (required) is the expected value of the
47 * file.encoding System property.
48 * The second argument (optional) is the value to set to the LANG/etc env vars.
49 */
50 public class TestFileEncoding {
|
1 /*
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.util.*;
25
26 /*
27 * @test
28 * @bug 8011194
29 * @summary Test value of file.encoding for corresponding value of LANG, etc
30 * @library ../../../../tools/launcher/ ../
31 * @modules java.compiler
32 * @build TestHelper TestFileEncoding ExpectedEncoding
33 * @run main TestFileEncoding UTF-8
34 * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding
35 * @run main TestFileEncoding UTF-8 en_US.UTF-8
36 * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding en_US.UTF-8
37 * @run main TestFileEncoding US-ASCII C
38 * @run main/othervm -Dfile.encoding=MyEncoding -DuserEncoding=MyEncoding TestFileEncoding MyEncoding C
39 * @author Brent Christian
40 */
41
42 /**
43 * Setup the environment and run a sub-test to check the expected value of
44 * file.encoding, based on the value(s) of encoding-related environment vars
45 * (LANG, LC_ALL, LC_CTYPE).
46 *
47 * The first argument (required) is the expected value of the
48 * file.encoding System property.
49 * The second argument (optional) is the value to set to the LANG/etc env vars.
50 */
51 public class TestFileEncoding {
|