File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
. "gopkg.in/check.v1"
7
7
"gopkg.in/src-d/go-billy.v3"
8
+ "gopkg.in/src-d/go-billy.v3/util"
8
9
)
9
10
10
11
// TempFileSuite is a convenient test suite to validate any implementation of
@@ -49,3 +50,37 @@ func (s *TempFileSuite) TestRemoveTempFile(c *C) {
49
50
c .Assert (f .Close (), IsNil )
50
51
c .Assert (s .FS .Remove (fn ), IsNil )
51
52
}
53
+
54
+ func (s * TempFileSuite ) TestTempFileMany (c * C ) {
55
+ for i := 0 ; i < 1024 ; i ++ {
56
+ var fs []billy.File
57
+
58
+ for j := 0 ; j < 100 ; j ++ {
59
+ f , err := s .FS .TempFile ("test-dir" , "test-prefix" )
60
+ c .Assert (err , IsNil )
61
+ fs = append (fs , f )
62
+ }
63
+
64
+ for _ , f := range fs {
65
+ c .Assert (f .Close (), IsNil )
66
+ c .Assert (s .FS .Remove (f .Name ()), IsNil )
67
+ }
68
+ }
69
+ }
70
+
71
+ func (s * TempFileSuite ) TestTempFileManyWithUtil (c * C ) {
72
+ for i := 0 ; i < 1024 ; i ++ {
73
+ var fs []billy.File
74
+
75
+ for j := 0 ; j < 100 ; j ++ {
76
+ f , err := util .TempFile (s .FS , "test-dir" , "test-prefix" )
77
+ c .Assert (err , IsNil )
78
+ fs = append (fs , f )
79
+ }
80
+
81
+ for _ , f := range fs {
82
+ c .Assert (f .Close (), IsNil )
83
+ c .Assert (s .FS .Remove (f .Name ()), IsNil )
84
+ }
85
+ }
86
+ }
You can’t perform that action at this time.
0 commit comments