-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrap_test.go
69 lines (60 loc) · 1.09 KB
/
wrap_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package unifs_test
import (
"fmt"
"io/fs"
"github.com/l4go/unifs"
)
func ExampleOpen() {
var err error
_, err = unifs.Open(testfs, "/test/sample.txt")
fmt.Println(err == nil)
// Output:
// true
}
func ExampleSub() {
var err error
var subfs fs.FS
subfs, err = unifs.Sub(testfs, "/test")
fmt.Println(err == nil)
_, err = unifs.Open(subfs, "/sample.txt")
fmt.Println(err == nil)
// Output:
// true
// true
}
func ExampleStat() {
var err error
_, err = unifs.Stat(testfs, "/test/sample.txt")
fmt.Println(err == nil)
// Output:
// true
}
func ExampleReadFile() {
var err error
_, err = unifs.ReadFile(testfs, "/test/sample.txt")
fmt.Println(err == nil)
// Output:
// true
}
func ExampleReadDir() {
var err error
_, err = unifs.ReadDir(testfs, "/")
fmt.Println(err == nil)
_, err = unifs.ReadDir(testfs, "/test")
fmt.Println(err == nil)
// Output:
// true
// true
}
func ExampleGlob() {
ups, err := unifs.Glob(testfs, "/test/*.txt")
if err != nil {
return
}
for _, up := range ups {
fmt.Println(up)
}
// Unordered output:
// /test/sample.txt
// /test/dummy.txt
}