langtools/test/com/sun/javadoc/testCharset/TestCharset.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 26665 e813baa25bf2
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
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
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26665
diff changeset
     2
 * Copyright (c) 2013, 2015, 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
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    26
 * @bug      7052170 8047745
19663
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
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    30
 * @library  ../lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26665
diff changeset
    31
 * @modules jdk.javadoc
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    32
 * @build    JavadocTester
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    33
 * @run main TestCharset
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
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    36
public class TestCharset extends JavadocTester {
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    37
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    38
    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
    39
        TestCharset tester = new TestCharset();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    40
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
    }
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    42
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
    void test() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
        javadoc("-d", "out",
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    46
                "-charset", "ISO-8859-1",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
                "pkg");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
        checkExit(Exit.OK);
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    50
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
        checkOutput("index.html", true,
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    52
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
        checkOutput("pkg/Foo.html", true,
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    54
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
        checkOutput("index.html", false,
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    57
            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"ISO-8859-1\">");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
        checkOutput("pkg/Foo.html", false,
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    59
            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"ISO-8859-1\">");
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    60
    }
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    61
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    62
    @Test
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    63
    void test1() {
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    64
        javadoc("-d", "out-1",
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    65
                "-sourcepath", testSrc,
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    66
                "pkg");
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    67
        checkExit(Exit.OK);
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    68
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    69
        checkOutput("index.html", true,
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    70
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    71
        checkOutput("pkg/Foo.html", true,
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 24399
diff changeset
    72
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    73
    }
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents:
diff changeset
    74
}