TestEncoding.java revision 3294:9adfb22ff08f
1121982Sjhb/*
2121982Sjhb * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
3121982Sjhb * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4121982Sjhb *
5121982Sjhb * This code is free software; you can redistribute it and/or modify it
6121982Sjhb * under the terms of the GNU General Public License version 2 only, as
7121982Sjhb * published by the Free Software Foundation.
8121982Sjhb *
9121982Sjhb * This code is distributed in the hope that it will be useful, but WITHOUT
10121982Sjhb * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11121982Sjhb * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12121982Sjhb * version 2 for more details (a copy is included in the LICENSE file that
13121982Sjhb * accompanied this code).
14121982Sjhb *
15121982Sjhb * You should have received a copy of the GNU General Public License version
16121982Sjhb * 2 along with this work; if not, write to the Free Software Foundation,
17121982Sjhb * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18121982Sjhb *
19121982Sjhb * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20121982Sjhb * or visit www.oracle.com if you need additional information or have any
21121982Sjhb * questions.
22121982Sjhb */
23121982Sjhb
24121982Sjhb/*
25121982Sjhb * @test
26121982Sjhb * @bug 4661481 8024096
27121982Sjhb * @summary This test determines if the value of the -encoding option is
28121982Sjhb * properly passed from Javadoc to the source file parser.
29121982Sjhb * @author jamieh
30121982Sjhb * @library ../lib
31121982Sjhb * @modules jdk.javadoc/jdk.javadoc.internal.tool
32121982Sjhb * @build JavadocTester
33121982Sjhb * @run main TestEncoding
34121982Sjhb */
35121982Sjhb
36121982Sjhbpublic class TestEncoding extends JavadocTester {
37121982Sjhb
38121982Sjhb    public static void main(String... args) throws Exception {
39121982Sjhb        TestEncoding tester = new TestEncoding();
40121982Sjhb        tester.runTests();
41121982Sjhb    }
42121982Sjhb
43121982Sjhb    @Test
44121982Sjhb    void test() {
45121982Sjhb        javadoc("-d", "out",
46121982Sjhb                "-sourcepath", testSrc,
47121982Sjhb                "-encoding", "iso-8859-1",
48121982Sjhb                testSrc("EncodeTest.java"));
49121982Sjhb        checkExit(Exit.OK);
50121982Sjhb
51121982Sjhb        // If ??? is found in the output, the source file was not read with the correct encoding setting.
52122572Sjhb        checkOutput("EncodeTest.html", false,
53121982Sjhb                "??");
54167273Sjhb    }
55121982Sjhb}
56121982Sjhb