Path: blob/master/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/TestDiagsLineCaret.java
40971 views
/*1* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 8267126 826717626* @summary javadoc should show "line and caret" for diagnostics27* @library /tools/lib ../../lib28* @modules jdk.javadoc/jdk.javadoc.internal.tool29* @build javadoc.tester.* MyTaglet30* @run main TestDiagsLineCaret31*/3233import java.io.IOException;34import java.nio.file.Path;3536import javadoc.tester.JavadocTester;37import toolbox.ToolBox;3839public class TestDiagsLineCaret extends JavadocTester {4041public static void main(String... args) throws Exception {42TestDiagsLineCaret tester = new TestDiagsLineCaret();43tester.runTests();44}4546ToolBox tb = new ToolBox();4748@Test49public void testDiags() throws IOException {50tb.writeJavaFiles(Path.of("."), """51/**52* First sentence.53* @since def 🥕 ghi54*/55public class MyClass { }56""");5758String testClasses = System.getProperty("test.classes");5960javadoc("-d", "out",61"-XDaccessInternalAPI",62"-tagletpath", testClasses,63"-taglet", "MyTaglet",64"MyClass.java");65checkExit(Exit.ERROR);6667checkOutput(Output.OUT, true,68"""69error: This is a error70warning: This is a warning71warning: This is a mandatory_warning72Note: This is a note73MyClass.java:5: error: This is a error for MyClass74public class MyClass { }75^76MyClass.java:5: warning: This is a warning for MyClass77public class MyClass { }78^79MyClass.java:5: warning: This is a mandatory_warning for MyClass80public class MyClass { }81^82MyClass.java:5: Note: This is a note for MyClass83public class MyClass { }84^85MyClass.java:3: error: This is a error: this is not a caret86* @since def 🥕 ghi87^88MyClass.java:3: warning: This is a warning: this is not a caret89* @since def 🥕 ghi90^91MyClass.java:3: warning: This is a mandatory_warning: this is not a caret92* @since def 🥕 ghi93^94MyClass.java:3: Note: This is a note: this is not a caret95* @since def 🥕 ghi96^97""",98"""993 errors1006 warnings101""");102}103}104105106