1 /* |
|
2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 8194955 8182765 |
|
27 * @summary Warn when default HTML version is used. |
|
28 * @library ../../lib |
|
29 * @modules jdk.javadoc/jdk.javadoc.internal.tool |
|
30 * @build javadoc.tester.* |
|
31 * @run main TestHtmlWarning |
|
32 */ |
|
33 |
|
34 import java.nio.file.Files; |
|
35 import java.nio.file.Path; |
|
36 import java.nio.file.Paths; |
|
37 import java.util.List; |
|
38 |
|
39 import javadoc.tester.JavadocTester; |
|
40 |
|
41 public class TestHtmlWarning extends JavadocTester { |
|
42 |
|
43 public static void main(String... args) throws Exception { |
|
44 Files.write(testFile, |
|
45 List.of("/** Comment. */", "public class C { }")); |
|
46 |
|
47 TestHtmlWarning tester = new TestHtmlWarning(); |
|
48 tester.runTests(); |
|
49 } |
|
50 |
|
51 private static final Path testFile = Paths.get("C.java"); |
|
52 private static final String warning |
|
53 = "javadoc: warning - You have specified the HTML version as HTML 4.01 by using the -html4 option.\n" |
|
54 + "The default is currently HTML5 and the support for HTML 4.01 will be removed\n" |
|
55 + "in a future release. To suppress this warning, please ensure that any HTML constructs\n" |
|
56 + "in your comments are valid in HTML5, and remove the -html4 option."; |
|
57 |
|
58 @Test |
|
59 public void testHtml4() { |
|
60 javadoc("-d", "out-4", |
|
61 "-html4", |
|
62 testFile.toString()); |
|
63 checkExit(Exit.OK); |
|
64 |
|
65 checkOutput(Output.OUT, true, warning); |
|
66 } |
|
67 |
|
68 @Test |
|
69 public void testHtml5() { |
|
70 javadoc("-d", "out-5", |
|
71 "-html5", |
|
72 testFile.toString()); |
|
73 checkExit(Exit.OK); |
|
74 |
|
75 checkOutput(Output.OUT, false, warning); |
|
76 } |
|
77 |
|
78 @Test |
|
79 public void testDefault() { |
|
80 javadoc("-d", "out-default", |
|
81 testFile.toString()); |
|
82 checkExit(Exit.OK); |
|
83 |
|
84 checkOutput(Output.OUT, false, warning); |
|
85 } |
|
86 } |
|