summaryrefslogtreecommitdiffstats
path: root/src/path/filepath/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/filepath/example_test.go')
-rw-r--r--src/path/filepath/example_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/path/filepath/example_test.go b/src/path/filepath/example_test.go
new file mode 100644
index 0000000..a1d680e
--- /dev/null
+++ b/src/path/filepath/example_test.go
@@ -0,0 +1,20 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package filepath_test
+
+import (
+ "fmt"
+ "path/filepath"
+)
+
+func ExampleExt() {
+ fmt.Printf("No dots: %q\n", filepath.Ext("index"))
+ fmt.Printf("One dot: %q\n", filepath.Ext("index.js"))
+ fmt.Printf("Two dots: %q\n", filepath.Ext("main.test.js"))
+ // Output:
+ // No dots: ""
+ // One dot: ".js"
+ // Two dots: ".js"
+}