generated from parrogo/gomod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestfilewriter.go
65 lines (52 loc) · 1.09 KB
/
testfilewriter.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
package writefs
/*
import (
"io/fs"
"testing/fstest"
)
type testWriteFS struct {
fstest.MapFS
expectedErr error
}
var _ WriteFS = testWriteFS{}
type testRemoveFS struct {
testWriteFS
removed string
}
//var _ RemoveFS = &testRemoveFS{}
func (fsys *testRemoveFS) Remove(name string) error {
fsys.removed = name
return nil
}
type testMkDirFS struct {
testWriteFS
created string
}
//var _ MkDirFS = &testMkDirFS{}
func (fsys *testMkDirFS) MkDir(name string, perm fs.FileMode) error {
fsys.created = name
return nil
}
type testFileWriter struct {
}
var _ FileWriter = testFileWriter{}
func (w testFileWriter) Close() error {
return nil
}
func (w testFileWriter) Write(buf []byte) (int, error) {
return len(buf), nil
}
func (w testFileWriter) Read(buf []byte) (int, error) {
return len(buf), nil
}
func (w testFileWriter) Stat() (fs.FileInfo, error) {
return nil, nil
}
// OpenFile ...
func (fsys testWriteFS) OpenFile(name string, flag int, perm fs.FileMode) (FileWriter, error) {
if !fs.ValidPath(name) {
return nil, &fs.PathError{}
}
return testFileWriter{}, fsys.expectedErr
}
*/