(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestRWFileHandleFlushRead(t *testing.T) { |
| 216 | _, _, fh := rwHandleCreateReadOnly(t) |
| 217 | |
| 218 | // Check Flush does nothing if read not called |
| 219 | err := fh.Flush() |
| 220 | assert.NoError(t, err) |
| 221 | assert.False(t, fh.closed) |
| 222 | |
| 223 | // Read data |
| 224 | buf := make([]byte, 256) |
| 225 | n, err := fh.Read(buf) |
| 226 | assert.True(t, err == io.EOF || err == nil) |
| 227 | assert.Equal(t, 16, n) |
| 228 | |
| 229 | // Check Flush does nothing if read called |
| 230 | err = fh.Flush() |
| 231 | assert.NoError(t, err) |
| 232 | assert.False(t, fh.closed) |
| 233 | |
| 234 | // Check flush does nothing if called again |
| 235 | err = fh.Flush() |
| 236 | assert.NoError(t, err) |
| 237 | assert.False(t, fh.closed) |
| 238 | |
| 239 | // Properly close the file |
| 240 | assert.NoError(t, fh.Close()) |
| 241 | } |
| 242 | |
| 243 | func TestRWFileHandleReleaseRead(t *testing.T) { |
| 244 | _, _, fh := rwHandleCreateReadOnly(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…