test/langtools/jdk/javadoc/doclet/testNonInlineHtmlTagRemoval/TestNonInlineHtmlTagRemoval.java
author bpatel
Tue, 06 Mar 2018 10:45:47 -0800
changeset 49139 771616d26ca1
parent 47216 71c04702a3d5
child 53097 2e82ca64b25d
permissions -rw-r--r--
8182765: HTML5 must be the default javadoc codegen mode in the near future Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43568
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     1
/*
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     4
 *
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     8
 *
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    13
 * accompanied this code).
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    14
 *
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    18
 *
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    21
 * questions.
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    22
 */
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    23
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    24
/*
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    25
 * @test
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    26
 * @bug      8048628 8174715 8182765
43568
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    27
 * @summary  Verify html inline tags are removed correctly in the first sentence.
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    28
 * @library  ../lib
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    29
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    30
 * @build    JavadocTester
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    31
 * @run main TestNonInlineHtmlTagRemoval
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    32
 */
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    33
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    34
public class TestNonInlineHtmlTagRemoval extends JavadocTester {
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    35
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    36
    public static void main(String... args) throws Exception {
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    37
        TestNonInlineHtmlTagRemoval tester = new TestNonInlineHtmlTagRemoval();
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    38
        tester.runTests();
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    39
    }
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    40
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    41
    @Test
43867
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    42
    void testPositive() {
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    43
        javadoc("-d", "out1",
43568
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    44
                "-sourcepath", testSrc,
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    45
                testSrc("C.java"));
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    46
        checkExit(Exit.ERROR);
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    47
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    48
        checkOutput(Output.OUT, true,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    49
                "attribute not supported in HTML5: compact",
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    50
                "attribute not supported in HTML5: type");
43568
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    51
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    52
        checkOutput("C.html", true,
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    53
                "<div class=\"block\">case1   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    54
                "<div class=\"block\">case2   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    55
                "<div class=\"block\">case3   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    56
                "<div class=\"block\">case4   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    57
                "<div class=\"block\">case5   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    58
                "<div class=\"block\">case6   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    59
                "<div class=\"block\">case7   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    60
                "<div class=\"block\">case8   end of sentence.</div>",
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    61
                "<div class=\"block\">case9   end of sentence.</div>",
43867
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    62
                "<div class=\"block\">caseA   end of sentence.</div>",
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    63
                "<div class=\"block\">caseB A block quote example:</div>");
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    64
    }
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    65
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    66
    @Test
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    67
    void testPositive_html4() {
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    68
        javadoc("-d", "out1-html4",
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    69
                "-html4",
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    70
                "-sourcepath", testSrc,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    71
                testSrc("C.java"));
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    72
        checkExit(Exit.OK);
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    73
    }
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    74
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 47216
diff changeset
    75
    @Test
43867
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    76
    void testNegative() {
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    77
        javadoc("-d", "out2",
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    78
                "-sourcepath", testSrc,
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    79
                testSrc("Negative.java"));
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    80
        checkExit(Exit.ERROR);
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    81
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    82
        checkOutput("Negative.html", true,
9d40b4d77b7f 8174715: Javadoc fails on JDK 7 and JDK 8 sources with StringIndexOutOfBoundsException
ksrini
parents: 43568
diff changeset
    83
                "<div class=\"block\">case1: A hanging &lt;  : xx<</div>");
43568
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    84
    }
0126b1f1e2be 8048628: javadoc strips HTML incorrectly; causes invalid generated HTML files
ksrini
parents:
diff changeset
    85
}