langtools/test/tools/javadoc/T4696488.java
author alanb
Wed, 21 Aug 2013 09:59:12 +0100
changeset 19565 e1593e8a70ff
parent 14061 9ac68cf0048b
child 30730 d3ce7619db2c
permissions -rw-r--r--
8023351: Add TEST.groups in preparation to simplify rules in jdk/test/Makefile Reviewed-by: lancea, mduigou
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14061
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     1
/*
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     4
 *
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     8
 *
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    13
 * accompanied this code).
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    14
 *
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    18
 *
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    21
 * questions.
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    22
 */
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    23
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    24
import com.sun.tools.doclets.internal.toolkit.Configuration;
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    25
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    26
/**
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    27
 * @test
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    28
 * @bug     4696488
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    29
 * @summary javadoc doesn't handle UNC paths for destination directory
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    30
 * @author  Jesse Glick
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    31
 * @run main T4696488 T4696488.java
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    32
 */
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    33
public class T4696488 {
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    34
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    35
    public static void main(String... args) {
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    36
        System.setProperty("file.separator", "/");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    37
        assertAddTrailingFileSep("/path/to/dir", "/path/to/dir/");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    38
        assertAddTrailingFileSep("/path/to/dir/", "/path/to/dir/");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    39
        assertAddTrailingFileSep("/path/to/dir//", "/path/to/dir/");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    40
        System.setProperty("file.separator", "\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    41
        assertAddTrailingFileSep("C:\\path\\to\\dir", "C:\\path\\to\\dir\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    42
        assertAddTrailingFileSep("C:\\path\\to\\dir\\", "C:\\path\\to\\dir\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    43
        assertAddTrailingFileSep("C:\\path\\to\\dir\\\\", "C:\\path\\to\\dir\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    44
        assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir", "\\\\server\\share\\path\\to\\dir\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    45
        assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir\\", "\\\\server\\share\\path\\to\\dir\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    46
        assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir\\\\", "\\\\server\\share\\path\\to\\dir\\");
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    47
    }
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    48
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    49
    private static void assertAddTrailingFileSep(String input, String expectedOutput) {
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    50
        String output = Configuration.addTrailingFileSep(input);
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    51
        if (!expectedOutput.equals(output)) {
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    52
            throw new Error("expected " + expectedOutput + " but was " + output);
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    53
        }
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    54
    }
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    55
9ac68cf0048b 4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff changeset
    56
}