test/langtools/jdk/javadoc/doclet/testDocEncoding/TestDocEncoding.java
author jjg
Tue, 10 Oct 2017 17:02:52 -0700
changeset 47328 d18df41954ba
parent 47216 71c04702a3d5
child 53097 2e82ca64b25d
permissions -rw-r--r--
8187521: In some corner cases the javadoc tool can reuse id attribute Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     1
/*
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
     2
 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     4
 *
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     8
 *
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    13
 * accompanied this code).
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    14
 *
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    18
 *
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    21
 * questions.
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    22
 */
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    23
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    24
/*
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    25
 * Portions Copyright (c) 2012 IBM Corporation
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    26
 */
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    27
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    28
/*
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    29
 * @test
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    30
 * @bug      8000743
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    31
 * @summary  Run tests on -docencoding to see if the value is
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    32
             used for stylesheet as well.
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    33
 * @author   jayashree viswanathan
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    34
 * @library  ../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    35
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    36
 * @build    JavadocTester
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    37
 * @run main TestDocEncoding
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    38
 */
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    39
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    40
import java.nio.charset.Charset;
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    41
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    42
public class TestDocEncoding extends JavadocTester {
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    43
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
        TestDocEncoding tester = new TestDocEncoding();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
    }
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    48
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
    void test() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
        javadoc("-d", "out",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
                "-docencoding", "Cp930",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
                "-notimestamp",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
                "pkg");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
        checkExit(Exit.OK);
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    57
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    58
        checkOutput("stylesheet.css", true,
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    59
                "body {\n"
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    60
                + "    background-color:#ffffff;");
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    61
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    62
        // reset the charset, for a negative test, that the -docencoding
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    63
        // was effective and that the output is not in UTF-8.
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
    64
        charset = Charset.forName("UTF-8");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    65
        checkOutput("stylesheet.css", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    66
                "body {\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
                + "    background-color:#ffffff;");
14261
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    68
    }
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    69
}
e638e77a9f15 8000743: docencoding not available to stylesheet
jjg
parents:
diff changeset
    70