github.com/tardisgo/tardisgo@v0.0.0-20161119180838-e0dd9a7e46b5/goroot/haxe/go1.4/src/path/filepath/example_unix_test.go_removed (about)

     1  // Copyright 2013 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  // +build !windows,!plan9
     6  
     7  package filepath_test
     8  
     9  import (
    10  	"fmt"
    11  	"path/filepath"
    12  )
    13  
    14  func ExampleSplitList() {
    15  	fmt.Println("On Unix:", filepath.SplitList("/a/b/c:/usr/bin"))
    16  	// Output:
    17  	// On Unix: [/a/b/c /usr/bin]
    18  }
    19  
    20  func ExampleRel() {
    21  	paths := []string{
    22  		"/a/b/c",
    23  		"/b/c",
    24  		"./b/c",
    25  	}
    26  	base := "/a"
    27  
    28  	fmt.Println("On Unix:")
    29  	for _, p := range paths {
    30  		rel, err := filepath.Rel(base, p)
    31  		fmt.Printf("%q: %q %v\n", p, rel, err)
    32  	}
    33  
    34  	// Output:
    35  	// On Unix:
    36  	// "/a/b/c": "b/c" <nil>
    37  	// "/b/c": "../b/c" <nil>
    38  	// "./b/c": "" Rel: can't make b/c relative to /a
    39  }