(t *testing.T)
| 236 | } |
| 237 | |
| 238 | func TestWriteFileHandleFlush(t *testing.T) { |
| 239 | _, vfs, fh := writeHandleCreate(t) |
| 240 | |
| 241 | // Check Flush already creates file for unwritten handles, without closing it |
| 242 | err := fh.Flush() |
| 243 | assert.NoError(t, err) |
| 244 | assert.False(t, fh.closed) |
| 245 | root, err := vfs.Root() |
| 246 | assert.NoError(t, err) |
| 247 | checkListing(t, root, []string{"file1,0,false"}) |
| 248 | |
| 249 | // Write some data |
| 250 | n, err := fh.Write([]byte("hello")) |
| 251 | assert.NoError(t, err) |
| 252 | assert.Equal(t, 5, n) |
| 253 | |
| 254 | // Check Flush closes file if write called |
| 255 | err = fh.Flush() |
| 256 | assert.NoError(t, err) |
| 257 | assert.True(t, fh.closed) |
| 258 | |
| 259 | // Check flush does nothing if called again |
| 260 | err = fh.Flush() |
| 261 | assert.NoError(t, err) |
| 262 | assert.True(t, fh.closed) |
| 263 | |
| 264 | // Check file was written properly |
| 265 | root, err = vfs.Root() |
| 266 | assert.NoError(t, err) |
| 267 | checkListing(t, root, []string{"file1,5,false"}) |
| 268 | } |
| 269 | |
| 270 | func TestWriteFileHandleRelease(t *testing.T) { |
| 271 | _, _, fh := writeHandleCreate(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…