TestHelpOption.java revision 3233:b5d08bc0d224
151792Smarcel/* 251792Smarcel * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. 351792Smarcel * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 451792Smarcel * 551792Smarcel * This code is free software; you can redistribute it and/or modify it 651792Smarcel * under the terms of the GNU General Public License version 2 only, as 751792Smarcel * published by the Free Software Foundation. 851792Smarcel * 951792Smarcel * This code is distributed in the hope that it will be useful, but WITHOUT 1051792Smarcel * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1151792Smarcel * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1251792Smarcel * version 2 for more details (a copy is included in the LICENSE file that 1351792Smarcel * accompanied this code). 1451792Smarcel * 1551792Smarcel * You should have received a copy of the GNU General Public License version 1651792Smarcel * 2 along with this work; if not, write to the Free Software Foundation, 1751792Smarcel * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1851792Smarcel * 1951792Smarcel * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2051792Smarcel * or visit www.oracle.com if you need additional information or have any 2151792Smarcel * questions. 2251792Smarcel */ 2351792Smarcel 2451792Smarcel/* 2551792Smarcel * @test 2651792Smarcel * @bug 4934778 4777599 6553182 8146427 8146475 2751792Smarcel * @summary Make sure that -help, -helpfile and -nohelp options work correctly. 2851792Smarcel * @author jamieh 2951792Smarcel * @library ../lib 3051792Smarcel * @modules jdk.javadoc 3151792Smarcel * @build JavadocTester TestHelpOption 3251907Smarcel * @run main TestHelpOption 3351792Smarcel */ 3451907Smarcel 3551907Smarcelpublic class TestHelpOption extends JavadocTester { 3651907Smarcel 3790776Sdeischen public static void main(String... args) throws Exception { 38105950Speter TestHelpOption tester = new TestHelpOption(); 3983047Sobrien tester.runTests(); 4051792Smarcel } 4153106Smarcel 4251792Smarcel @Test 4351792Smarcel void testWithOption() { 4451792Smarcel javadoc("-d", "out1", 4551792Smarcel "-sourcepath", testSrc, 4651792Smarcel "-help", 4751792Smarcel testSrc("Sample.java")); 4851792Smarcel checkExit(Exit.OK); 4951792Smarcel 5051792Smarcel checkOutput(true); 5151792Smarcel } 5251792Smarcel 5351792Smarcel @Test 5451792Smarcel void testWithoutOption() { 5554120Smarcel javadoc("-d", "out2", 5653106Smarcel "-sourcepath", testSrc, 5751792Smarcel testSrc("Sample.java")); 5851792Smarcel checkExit(Exit.OK); 5951792Smarcel } 6051792Smarcel 6151792Smarcel @Test 6251792Smarcel void testNohelpOption() { 6351792Smarcel javadoc("-d", "out3", 6451792Smarcel "-sourcepath", testSrc, 6551792Smarcel "-nohelp", 6651792Smarcel testSrc("Sample.java")); 6751792Smarcel checkExit(Exit.OK); 6851792Smarcel } 6951792Smarcel 7051792Smarcel @Test 7151792Smarcel void testHelpfileOption() { 7251792Smarcel javadoc("-d", "out4", 7390776Sdeischen "-sourcepath", testSrc, 74105950Speter "-helpfile", testSrc("test-help.html"), 75105950Speter testSrc("Sample.java")); 76105950Speter checkExit(Exit.OK); 77105950Speter checkOutput("Sample.html", true, 78105950Speter "<li><a href=\"test-help.html\">Help</a></li>"); 79105950Speter } 80105950Speter 8151792Smarcel @Test 82105950Speter void testHelpfileReuseOption() { 83105950Speter javadoc("-d", "out5", 84105950Speter "-sourcepath", testSrc, 85105950Speter "-helpfile", testSrc("test-help.html"), 86105950Speter "-helpfile", testSrc("test-help.html"), 87105950Speter testSrc("Sample.java")); 88105950Speter checkExit(Exit.FAILED); 89105950Speter } 90105950Speter 91105950Speter @Test 92247047Skib void testHelpfileNohelpConflict() { 9351907Smarcel javadoc("-d", "out6", 9451907Smarcel "-sourcepath", testSrc, 95 "-helpfile", testSrc("test-help.html"), 96 "-nohelp", 97 testSrc("Sample.java")); 98 checkExit(Exit.FAILED); 99 } 100 101 private void checkOutput(boolean withOption) { 102 checkOutput(Output.OUT, withOption, 103 "-d ", 104 "-use ", 105 "-version ", 106 "-author ", 107 "-docfilessubdirs ", 108 "-splitindex ", 109 "-windowtitle ", 110 "-doctitle ", 111 "-header ", 112 "-footer ", 113 "-bottom ", 114 "-link ", 115 "-linkoffline ", 116 "-excludedocfilessubdir ", 117 "-group ", 118 "-nocomment ", 119 "-nodeprecated ", 120 "-noqualifier ", 121 "-nosince ", 122 "-notimestamp ", 123 "-nodeprecatedlist ", 124 "-notree ", 125 "-noindex ", 126 "-nohelp ", 127 "-nonavbar ", 128 "-serialwarn ", 129 "-tag ", 130 "-taglet ", 131 "-tagletpath ", 132 "-charset ", 133 "-helpfile ", 134 "-linksource ", 135 "-sourcetab ", 136 "-keywords ", 137 "-stylesheetfile ", 138 "-docencoding "); 139 140 checkOutput("Sample.html", !withOption, 141 "<li><a href=\"help-doc.html\">Help</a></li>"); 142 } 143} 144