test/jdk/nio/zipfs/PathOps.java
Print this page
*** 29,43 ****
import java.nio.file.Path;
/**
*
* @test
! * @bug 8038500 8040059
* @summary Tests path operations for zip provider.
*
* @run main PathOps
* @run main/othervm/java.security.policy=test.policy PathOps
*/
public class PathOps {
static final java.io.PrintStream out = System.out;
--- 29,44 ----
import java.nio.file.Path;
/**
*
* @test
! * @bug 8038500 8040059 8139956 8146754
* @summary Tests path operations for zip provider.
*
* @run main PathOps
* @run main/othervm/java.security.policy=test.policy PathOps
+ * @modules jdk.zipfs
*/
public class PathOps {
static final java.io.PrintStream out = System.out;
*** 422,431 ****
--- 423,437 ----
.relativize("a/b/c", "a/b/c")
.relativize("", "");
test("/")
.relativize("/a", "a")
.relativize("/a/c", "a/c");
+ // 8146754
+ test("/tmp/path")
+ .relativize("/tmp/path/a.txt", "a.txt");
+ test("/tmp/path/")
+ .relativize("/tmp/path/a.txt", "a.txt");
// normalize
test("/")
.normalize("/");
test("foo")
*** 484,493 ****
--- 490,508 ----
.name("bar");
// isSameFile
test("/fileDoesNotExist")
.isSameFile("/fileDoesNotExist");
+
+ // 8139956
+ out.println("check getNameCount");
+ int nc = fs.getPath("/").relativize(fs.getPath("/")).getNameCount();
+ if (nc != 1) {
+ out.format("\tExpected: 1\n");
+ out.format("\tActual: %d\n", nc);
+ throw new RuntimeException("getNameCount of empty path failed");
+ }
}
static void npes() {
header("NullPointerException");