summaryrefslogtreecommitdiff
path: root/libgo/go/path/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/path/example_test.go')
-rw-r--r--libgo/go/path/example_test.go40
1 files changed, 34 insertions, 6 deletions
diff --git a/libgo/go/path/example_test.go b/libgo/go/path/example_test.go
index 88b76557f2b..21ed1fb2fcd 100644
--- a/libgo/go/path/example_test.go
+++ b/libgo/go/path/example_test.go
@@ -13,7 +13,12 @@ import (
func ExampleBase() {
fmt.Println(path.Base("/a/b"))
- // Output: b
+ fmt.Println(path.Base("/"))
+ fmt.Println(path.Base(""))
+ // Output:
+ // b
+ // /
+ // .
}
func ExampleClean() {
@@ -24,6 +29,7 @@ func ExampleClean() {
"a/c/b/..",
"/../a/c",
"/../a/b/../././/c",
+ "",
}
for _, p := range paths {
@@ -37,16 +43,29 @@ func ExampleClean() {
// Clean("a/c/b/..") = "a/c"
// Clean("/../a/c") = "/a/c"
// Clean("/../a/b/../././/c") = "/a/c"
+ // Clean("") = "."
}
func ExampleDir() {
fmt.Println(path.Dir("/a/b/c"))
- // Output: /a/b
+ fmt.Println(path.Dir("a/b/c"))
+ fmt.Println(path.Dir("/"))
+ fmt.Println(path.Dir(""))
+ // Output:
+ // /a/b
+ // a/b
+ // /
+ // .
}
func ExampleExt() {
fmt.Println(path.Ext("/a/b/c/bar.css"))
- // Output: .css
+ fmt.Println(path.Ext("/"))
+ fmt.Println(path.Ext(""))
+ // Output:
+ // .css
+ //
+ //
}
func ExampleIsAbs() {
@@ -58,17 +77,26 @@ func ExampleJoin() {
fmt.Println(path.Join("a", "b", "c"))
fmt.Println(path.Join("a", "b/c"))
fmt.Println(path.Join("a/b", "c"))
- fmt.Println(path.Join("a/b", "/c"))
+ fmt.Println(path.Join("", ""))
+ fmt.Println(path.Join("a", ""))
+ fmt.Println(path.Join("", "a"))
// Output:
// a/b/c
// a/b/c
// a/b/c
- // a/b/c
+ //
+ // a
+ // a
}
func ExampleSplit() {
fmt.Println(path.Split("static/myfile.css"))
- // Output: static/ myfile.css
+ fmt.Println(path.Split("myfile.css"))
+ fmt.Println(path.Split(""))
+ // Output:
+ // static/ myfile.css
+ // myfile.css
+ //
}
*/