diff options
Diffstat (limited to 'libgo/go/path/example_test.go')
-rw-r--r-- | libgo/go/path/example_test.go | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libgo/go/path/example_test.go b/libgo/go/path/example_test.go index f0ac1301408..ca18b32305e 100644 --- a/libgo/go/path/example_test.go +++ b/libgo/go/path/example_test.go @@ -11,17 +11,11 @@ import ( "path" ) -// b func ExampleBase() { fmt.Println(path.Base("/a/b")) + // Output: b } -// Clean("a/c") = "a/c" -// Clean("a//c") = "a/c" -// Clean("a/c/.") = "a/c" -// Clean("a/c/b/..") = "a/c" -// Clean("/../a/c") = "/a/c" -// Clean("/../a/b/../././/c") = "/a/c" func ExampleClean() { paths := []string{ "a/c", @@ -35,31 +29,39 @@ func ExampleClean() { for _, p := range paths { fmt.Printf("Clean(%q) = %q\n", p, path.Clean(p)) } + + // Output: + // Clean("a/c") = "a/c" + // Clean("a//c") = "a/c" + // Clean("a/c/.") = "a/c" + // Clean("a/c/b/..") = "a/c" + // Clean("/../a/c") = "/a/c" + // Clean("/../a/b/../././/c") = "/a/c" } -// /a/b func ExampleDir() { fmt.Println(path.Dir("/a/b/c")) + // Output: /a/b } -// .css func ExampleExt() { fmt.Println(path.Ext("/a/b/c/bar.css")) + // Output: .css } -// true func ExampleIsAbs() { fmt.Println(path.IsAbs("/dev/null")) + // Output: true } -// a/b/c func ExampleJoin() { fmt.Println(path.Join("a", "b", "c")) + // Output: a/b/c } -// static/ myfile.css func ExampleSplit() { fmt.Println(path.Split("static/myfile.css")) + // Output: static/ myfile.css } */ |