test/jdk/nio/zipfs/PathOps.java

Print this page




 163         out.println("check path is absolute");
 164         checkPath();
 165         check(path.isAbsolute(), true);
 166         return this;
 167     }
 168 
 169     PathOps notAbsolute() {
 170         out.println("check path is not absolute");
 171         checkPath();
 172         check(path.isAbsolute(), false);
 173         return this;
 174     }
 175 
 176     PathOps resolve(String other, String expected) {
 177         out.format("test resolve %s\n", other);
 178         checkPath();
 179         check(path.resolve(other), expected);
 180         return this;
 181     }
 182 







 183     PathOps resolveSibling(String other, String expected) {
 184         out.format("test resolveSibling %s\n", other);
 185         checkPath();
 186         check(path.resolveSibling(other), expected);
 187         return this;
 188     }
 189 
 190     PathOps relativize(String other, String expected) {
 191         out.format("test relativize %s\n", other);
 192         checkPath();
 193         Path that = fs.getPath(other);
 194         check(path.relativize(that), expected);
 195         return this;
 196     }
 197 
 198     PathOps normalize(String expected) {
 199         out.println("check normalized path");
 200         checkPath();
 201         check(path.normalize(), expected);
 202         return this;


 367         test("/tmp")
 368             .absolute();
 369         test("tmp")
 370             .notAbsolute();
 371         test("")
 372             .notAbsolute();
 373 
 374         // resolve
 375         test("/tmp")
 376             .resolve("foo", "/tmp/foo")
 377             .resolve("/foo", "/foo")
 378             .resolve("", "/tmp");
 379         test("tmp")
 380             .resolve("foo", "tmp/foo")
 381             .resolve("/foo", "/foo")
 382             .resolve("", "tmp");
 383         test("")
 384             .resolve("", "")
 385             .resolve("foo", "foo")
 386             .resolve("/foo", "/foo");
























 387 
 388         // resolveSibling
 389         test("foo")
 390             .resolveSibling("bar", "bar")
 391             .resolveSibling("/bar", "/bar")
 392             .resolveSibling("", "");
 393         test("foo/bar")
 394             .resolveSibling("gus", "foo/gus")
 395             .resolveSibling("/gus", "/gus")
 396             .resolveSibling("", "foo");
 397         test("/foo")
 398             .resolveSibling("gus", "/gus")
 399             .resolveSibling("/gus", "/gus")
 400             .resolveSibling("", "/");
 401         test("/foo/bar")
 402             .resolveSibling("gus", "/foo/gus")
 403             .resolveSibling("/gus", "/gus")
 404             .resolveSibling("", "/foo");
 405         test("")
 406             .resolveSibling("foo", "foo")




 163         out.println("check path is absolute");
 164         checkPath();
 165         check(path.isAbsolute(), true);
 166         return this;
 167     }
 168 
 169     PathOps notAbsolute() {
 170         out.println("check path is not absolute");
 171         checkPath();
 172         check(path.isAbsolute(), false);
 173         return this;
 174     }
 175 
 176     PathOps resolve(String other, String expected) {
 177         out.format("test resolve %s\n", other);
 178         checkPath();
 179         check(path.resolve(other), expected);
 180         return this;
 181     }
 182 
 183     PathOps resolvePath(String other, String expected) {
 184         out.format("test resolve %s\n", other);
 185         checkPath();
 186         check(path.resolve(fs.getPath(other)), expected);
 187         return this;
 188     }
 189 
 190     PathOps resolveSibling(String other, String expected) {
 191         out.format("test resolveSibling %s\n", other);
 192         checkPath();
 193         check(path.resolveSibling(other), expected);
 194         return this;
 195     }
 196 
 197     PathOps relativize(String other, String expected) {
 198         out.format("test relativize %s\n", other);
 199         checkPath();
 200         Path that = fs.getPath(other);
 201         check(path.relativize(that), expected);
 202         return this;
 203     }
 204 
 205     PathOps normalize(String expected) {
 206         out.println("check normalized path");
 207         checkPath();
 208         check(path.normalize(), expected);
 209         return this;


 374         test("/tmp")
 375             .absolute();
 376         test("tmp")
 377             .notAbsolute();
 378         test("")
 379             .notAbsolute();
 380 
 381         // resolve
 382         test("/tmp")
 383             .resolve("foo", "/tmp/foo")
 384             .resolve("/foo", "/foo")
 385             .resolve("", "/tmp");
 386         test("tmp")
 387             .resolve("foo", "tmp/foo")
 388             .resolve("/foo", "/foo")
 389             .resolve("", "tmp");
 390         test("")
 391             .resolve("", "")
 392             .resolve("foo", "foo")
 393             .resolve("/foo", "/foo");
 394         test("/")
 395             .resolve("", "/")
 396             .resolve("foo", "/foo")
 397             .resolve("/foo", "/foo")
 398             .resolve("/foo/", "/foo");
 399 
 400         // resolve(Path)
 401         test("/tmp")
 402             .resolvePath("foo", "/tmp/foo")
 403             .resolvePath("/foo", "/foo")
 404             .resolvePath("", "/tmp");
 405         test("tmp")
 406             .resolvePath("foo", "tmp/foo")
 407             .resolvePath("/foo", "/foo")
 408             .resolvePath("", "tmp");
 409         test("")
 410             .resolvePath("", "")
 411             .resolvePath("foo", "foo")
 412             .resolvePath("/foo", "/foo");
 413         test("/")
 414             .resolvePath("", "/")
 415             .resolvePath("foo", "/foo")
 416             .resolvePath("/foo", "/foo")
 417             .resolvePath("/foo/", "/foo");
 418 
 419         // resolveSibling
 420         test("foo")
 421             .resolveSibling("bar", "bar")
 422             .resolveSibling("/bar", "/bar")
 423             .resolveSibling("", "");
 424         test("foo/bar")
 425             .resolveSibling("gus", "foo/gus")
 426             .resolveSibling("/gus", "/gus")
 427             .resolveSibling("", "foo");
 428         test("/foo")
 429             .resolveSibling("gus", "/gus")
 430             .resolveSibling("/gus", "/gus")
 431             .resolveSibling("", "/");
 432         test("/foo/bar")
 433             .resolveSibling("gus", "/foo/gus")
 434             .resolveSibling("/gus", "/gus")
 435             .resolveSibling("", "/foo");
 436         test("")
 437             .resolveSibling("foo", "foo")