Path: blob/master/test/langtools/jdk/javadoc/doclet/testDocFileDir/TestDocFileDir.java
40971 views
/*1* Copyright (c) 2002, 2019, 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 4258405 4973606 802409626* @summary This test verifies that the doc-file directory does not27* get overwritten when the sourcepath is equal to the destination28* directory.29* Also test that -docfilessubdirs and -excludedocfilessubdir both work.30* @library ../../lib31* @modules jdk.javadoc/jdk.javadoc.internal.tool32* @build javadoc.tester.*33* @run main TestDocFileDir34*/3536import javadoc.tester.JavadocTester;3738public class TestDocFileDir extends JavadocTester {3940public static void main(String... args) throws Exception {41TestDocFileDir tester = new TestDocFileDir();42tester.runTests();43}4445// Output dir = "", Input dir = ""46@Test47public void test1() {48copyDir(testSrc("pkg"), ".");49setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);50javadoc("pkg/C.java");51checkExit(Exit.OK);52checkOutput("pkg/doc-files/testfile.txt", true,53"This doc file did not get trashed.");54}5556// Output dir = Input Dir57@Test58public void test2() {59String outdir = "out2";60copyDir(testSrc("pkg"), outdir);61setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);62javadoc("-d", outdir,63"-sourcepath", "blah" + PS + outdir + PS + "blah",64"pkg");65checkExit(Exit.OK);66checkOutput("pkg/doc-files/testfile.txt", true,67"This doc file did not get trashed.");68}6970// Exercising -docfilessubdirs and -excludedocfilessubdir71@Test72public void test3() {73String outdir = "out3";74setOutputDirectoryCheck(DirectoryCheck.NONE);75javadoc("-d", outdir,76"-sourcepath", testSrc,77"-docfilessubdirs",78"-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",79"pkg");80checkExit(Exit.OK);81checkFiles(true,82"pkg/doc-files/subdir-used1/testfile.txt",83"pkg/doc-files/subdir-used2/testfile.txt");84checkFiles(false,85"pkg/doc-files/subdir-excluded1/testfile.txt",86"pkg/doc-files/subdir-excluded2/testfile.txt");87}88}899091