TestCustomTag.java revision 3294:9adfb22ff08f
1/* 2 * Copyright (c) 2013, 2016, 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 8006248 27 * @summary Test custom tag. Verify that an unknown tag generates appropriate warnings. 28 * @author Bhavesh Patel 29 * @library ../lib 30 * @modules jdk.javadoc/com.sun.tools.doclets.internal.toolkit 31 * jdk.javadoc/com.sun.tools.doclets.internal.toolkit.taglets 32 * jdk.javadoc/com.sun.tools.doclets.internal.toolkit.util 33 * @build JavadocTester taglets.CustomTag 34 * @run main TestCustomTag 35 */ 36 37public class TestCustomTag extends JavadocTester { 38 39 public static void main(String... args) throws Exception { 40 TestCustomTag tester = new TestCustomTag(); 41 tester.runTests(); 42 } 43 44 @Test 45 void test1() { 46 javadoc("-Xdoclint:none", 47 "-d", "out-1", 48 "-tagletpath", testSrc, // TODO: probably useless 49 "-taglet", "taglets.CustomTag", 50 "-sourcepath", testSrc, 51 "-XDaccessInternalAPI", 52 testSrc("TagTestClass.java")); 53 checkExit(Exit.OK); 54 55 checkOutput(Output.WARNING, true, 56 "warning - @unknownTag is an unknown tag."); 57 } 58 59 @Test 60 void test2() { 61 javadoc("-d", "out-2", 62 "-tagletpath", testSrc, // TODO: probably useless 63 "-taglet", "taglets.CustomTag", 64 "-sourcepath", testSrc, 65 "-XDaccessInternalAPI", 66 testSrc("TagTestClass.java")); 67 checkExit(Exit.FAILED); 68 69 checkOutput(Output.ERROR, true, 70 "error: unknown tag: unknownTag"); 71 } 72 73 @Test 74 void test3() { 75 javadoc("-Xdoclint:none", 76 "-d", "out-3", 77 "-sourcepath", testSrc, 78 testSrc("TagTestClass.java")); 79 checkExit(Exit.OK); 80 81 checkOutput(Output.WARNING, true, 82 "warning - @customTag is an unknown tag.", 83 "warning - @unknownTag is an unknown tag."); 84 } 85 86 @Test 87 void test4() { 88 javadoc("-d", "out-4", 89 "-sourcepath", testSrc, 90 testSrc("TagTestClass.java")); 91 checkExit(Exit.FAILED); 92 93 checkOutput(Output.ERROR, true, 94 "error: unknown tag: customTag", 95 "error: unknown tag: unknownTag"); 96 } 97} 98