@@ -17,17 +17,20 @@ func TestMain(m *testing.M) {
17
17
for _ , f := range files {
18
18
file , err := os .Open (fmt .Sprintf ("./testdata/%s" , f ))
19
19
if err != nil {
20
+ fmt .Fprintf (os .Stderr , "Failed to open test data file: %v\n " , err )
20
21
os .Exit (1 )
21
22
}
22
23
23
24
err = s .FilesWrite (context .Background (), fmt .Sprintf ("/testdata/%s" , f ), file , FilesWrite .Parents (true ), FilesWrite .Create (true ))
24
25
if err != nil {
26
+ fmt .Fprintf (os .Stderr , "Failed to write test data, not running tests: %v\n " , err )
25
27
os .Exit (1 )
26
28
}
27
29
}
28
30
29
31
exitVal := m .Run ()
30
32
if err := s .FilesRm (context .Background (), "/testdata" , true ); err != nil {
33
+ fmt .Fprintf (os .Stderr , "Failed to remove test data: %v\n " , err )
31
34
os .Exit (1 )
32
35
}
33
36
os .Exit (exitVal )
@@ -115,7 +118,7 @@ func TestFilesMv(t *testing.T) {
115
118
is .Nil (err )
116
119
is .Equal (stat .Hash , "QmfZt7xPekp7npSM6DHDUnFseAiNZQs7wq6muH9o99RsCB" )
117
120
118
- stat , err = s .FilesStat (context .Background (), "/testdata/readme" )
121
+ _ , err = s .FilesStat (context .Background (), "/testdata/readme" )
119
122
is .NotNil (err )
120
123
121
124
err = s .FilesMv (context .Background (), "/testdata/readme2" , "/testdata/readme" )
@@ -184,6 +187,8 @@ func TestFilesWrite(t *testing.T) {
184
187
is .Equal (string (resBytes ), "ipfs" )
185
188
186
189
file , err = ioutil .ReadFile ("./testdata/ping" )
190
+ is .Nil (err )
191
+
187
192
err = s .FilesWrite (context .Background (), "/testdata/ping" , bytes .NewBuffer (file ), FilesWrite .Offset (0 ), FilesWrite .Count (2 ), FilesWrite .Truncate (true ))
188
193
is .Nil (err )
189
194
0 commit comments