aoqi@0: /* aoqi@0: * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: /* aoqi@0: * @test aoqi@0: * @bug 4651598 8026567 aoqi@0: * @summary Javadoc wrongly inserts tags when using multiple @author tags aoqi@0: * @author dkramer aoqi@0: * @run main AuthorDD aoqi@0: */ aoqi@0: aoqi@0: aoqi@0: import com.sun.javadoc.*; aoqi@0: import java.util.*; aoqi@0: import java.io.*; aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * Runs javadoc and runs regression tests on the resulting HTML. aoqi@0: * It reads each file, complete with newlines, into a string to easily aoqi@0: * find strings that contain newlines. aoqi@0: */ aoqi@0: public class AuthorDD aoqi@0: { aoqi@0: private static final String BUGID = "4651598"; aoqi@0: private static final String BUGNAME = "AuthorDD"; aoqi@0: private static final String FS = System.getProperty("file.separator"); aoqi@0: private static final String PS = System.getProperty("path.separator"); aoqi@0: private static final String NL = System.getProperty("line.separator"); aoqi@0: aoqi@0: // Subtest number. Needed because runResultsOnHTML is run twice, and subtestNum aoqi@0: // should increment across subtest runs. aoqi@0: public static int subtestNum = 0; aoqi@0: public static int numSubtestsPassed = 0; aoqi@0: aoqi@0: // Entry point aoqi@0: public static void main(String[] args) { aoqi@0: aoqi@0: // Directory that contains source files that javadoc runs on aoqi@0: String srcdir = System.getProperty("test.src", "."); aoqi@0: aoqi@0: // Test for all cases except the split index page aoqi@0: runJavadoc(new String[] {"-d", BUGID, aoqi@0: "-author", aoqi@0: "-version", aoqi@0: "-sourcepath", srcdir, aoqi@0: "p1"}); aoqi@0: runTestsOnHTML(testArray); aoqi@0: aoqi@0: printSummary(); aoqi@0: } aoqi@0: aoqi@0: /** Run javadoc */ aoqi@0: public static void runJavadoc(String[] javadocArgs) { aoqi@0: if (com.sun.tools.javadoc.Main.execute(AuthorDD.class.getClassLoader(), aoqi@0: javadocArgs) != 0) { aoqi@0: throw new Error("Javadoc failed to execute"); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Assign value for [ stringToFind, filename ] aoqi@0: * NOTE: The standard doclet uses the same separator "\n" for all OS's aoqi@0: */ aoqi@0: private static final String[][] testArray = { aoqi@0: aoqi@0: // Test single @since tag: aoqi@0: aoqi@0: { "