langtools/test/com/sun/javadoc/testCharset/TestCharset.java
author jjg
Wed, 16 Apr 2014 16:17:09 -0700
changeset 23971 f5ff1f5a8dee
parent 19663 9a3447cabe1a
child 24065 fc4022e50129
permissions -rw-r--r--
8031649: Clean up javadoc tests Reviewed-by: jjg Contributed-by: neil.toda@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     1
/*
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 19663
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     4
 *
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     8
 *
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    13
 * accompanied this code).
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    14
 *
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    18
 *
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    21
 * questions.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    22
 */
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    23
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    24
/*
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    25
 * @test
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    26
 * @bug      7052170
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    27
 * @summary  Run a test on -charset to make sure the charset gets generated as a
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    28
 *           part of the meta tag.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    29
 * @author   Bhavesh Patel
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    30
 * @library  ../lib/
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    31
 * @build    JavadocTester TestCharset
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    32
 * @run main TestCharset
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    33
 */
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    34
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    35
public class TestCharset extends JavadocTester {
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    36
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    37
    //Test information.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    38
    private static final String BUG_ID = "7052170";
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    39
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    40
    //Javadoc arguments.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    41
    private static final String[] ARGS = new String[] {
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    42
        "-d", BUG_ID, "-charset", "UTF-8", "-sourcepath", SRC_DIR, "pkg"
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    43
    };
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    44
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    45
    private static final String[][] TEST = {
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 19663
diff changeset
    46
        {BUG_ID + "/index.html",
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    47
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"},
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 19663
diff changeset
    48
        {BUG_ID + "/pkg/Foo.html",
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    49
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"}
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    50
    };
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    51
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    52
    private static final String[][] NEGATED_TEST = {
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 19663
diff changeset
    53
        {BUG_ID + "/index.html",
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    54
            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"},
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 19663
diff changeset
    55
        {BUG_ID + "/pkg/Foo.html",
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    56
            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"}
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    57
    };
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    58
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    59
    /**
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    60
     * The entry point of the test.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    61
     * @param args the array of command line arguments.
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    62
     */
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    63
    public static void main(String[] args) {
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    64
        TestCharset tester = new TestCharset();
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    65
        run(tester, ARGS, TEST, NEGATED_TEST);
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    66
        tester.printSummary();
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    67
    }
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    68
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    69
    /**
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    70
     * {@inheritDoc}
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    71
     */
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    72
    public String getBugId() {
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    73
        return BUG_ID;
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    74
    }
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    75
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    76
    /**
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    77
     * {@inheritDoc}
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    78
     */
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    79
    public String getBugName() {
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    80
        return getClass().getName();
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    81
    }
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    82
}