diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-08-21 14:18:06 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-08-21 14:18:06 -0400 |
| commit | 0ef562592fe05b50b0ae8fce495ee7e2eec791f0 (patch) | |
| tree | d1c0f668e473ebdcb4a30e190008043bdb223bd9 /src/path | |
| parent | ac5c406ef0ab20e2a11f57470271266ef4265221 (diff) | |
| parent | 9679b307334bce77cc6e50751956a4c717e9458c (diff) | |
| download | go-0ef562592fe05b50b0ae8fce495ee7e2eec791f0.tar.xz | |
[dev.link] all: merge branch 'master' into dev.link
Change-Id: Ic66b5138f3ecd9e9a48d7ab05782297c06e4a5b5
Diffstat (limited to 'src/path')
| -rw-r--r-- | src/path/example_test.go | 5 | ||||
| -rw-r--r-- | src/path/filepath/example_unix_test.go | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/path/example_test.go b/src/path/example_test.go index 67b9718664..e30ebd13dc 100644 --- a/src/path/example_test.go +++ b/src/path/example_test.go @@ -79,13 +79,18 @@ 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", "../../../xyz")) + fmt.Println(path.Join("", "")) fmt.Println(path.Join("a", "")) fmt.Println(path.Join("", "a")) + // Output: // a/b/c // a/b/c // a/b/c + // ../xyz // // a // a diff --git a/src/path/filepath/example_unix_test.go b/src/path/filepath/example_unix_test.go index 23f21380d0..c9d6944518 100644 --- a/src/path/filepath/example_unix_test.go +++ b/src/path/filepath/example_unix_test.go @@ -72,12 +72,16 @@ func ExampleJoin() { fmt.Println(filepath.Join("a", "b/c")) fmt.Println(filepath.Join("a/b", "c")) fmt.Println(filepath.Join("a/b", "/c")) + + fmt.Println(filepath.Join("a/b", "../../../xyz")) + // Output: // On Unix: // a/b/c // a/b/c // a/b/c // a/b/c + // ../xyz } func ExampleMatch() { |
