github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/third_party/gofrontend/libgo/go/path/example_test.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package path 6 7 /* Commented out until gccgo has example support. 8 9 import ( 10 "fmt" 11 "path" 12 ) 13 14 func ExampleBase() { 15 fmt.Println(path.Base("/a/b")) 16 // Output: b 17 } 18 19 func ExampleClean() { 20 paths := []string{ 21 "a/c", 22 "a//c", 23 "a/c/.", 24 "a/c/b/..", 25 "/../a/c", 26 "/../a/b/../././/c", 27 } 28 29 for _, p := range paths { 30 fmt.Printf("Clean(%q) = %q\n", p, path.Clean(p)) 31 } 32 33 // Output: 34 // Clean("a/c") = "a/c" 35 // Clean("a//c") = "a/c" 36 // Clean("a/c/.") = "a/c" 37 // Clean("a/c/b/..") = "a/c" 38 // Clean("/../a/c") = "/a/c" 39 // Clean("/../a/b/../././/c") = "/a/c" 40 } 41 42 func ExampleDir() { 43 fmt.Println(path.Dir("/a/b/c")) 44 // Output: /a/b 45 } 46 47 func ExampleExt() { 48 fmt.Println(path.Ext("/a/b/c/bar.css")) 49 // Output: .css 50 } 51 52 func ExampleIsAbs() { 53 fmt.Println(path.IsAbs("/dev/null")) 54 // Output: true 55 } 56 57 func ExampleJoin() { 58 fmt.Println(path.Join("a", "b", "c")) 59 // Output: a/b/c 60 } 61 62 func ExampleSplit() { 63 fmt.Println(path.Split("static/myfile.css")) 64 // Output: static/ myfile.css 65 } 66 67 */