(t *testing.T)
| 209 | } |
| 210 | |
| 211 | func TestNewObjectWithLeadingSlash(t *testing.T) { |
| 212 | f := prepare(t) |
| 213 | |
| 214 | o, err := f.NewObject(context.Background(), "/four/under four.txt") |
| 215 | require.NoError(t, err) |
| 216 | |
| 217 | assert.Equal(t, "/four/under four.txt", o.Remote()) |
| 218 | assert.Equal(t, int64(8+lineEndSize), o.Size()) |
| 219 | _, ok := o.(*Object) |
| 220 | assert.True(t, ok) |
| 221 | |
| 222 | // Test the time is correct on the object |
| 223 | |
| 224 | tObj := o.ModTime(context.Background()) |
| 225 | |
| 226 | fi, err := os.Stat(filepath.Join(filesPath, "four", "under four.txt")) |
| 227 | require.NoError(t, err) |
| 228 | tFile := fi.ModTime() |
| 229 | |
| 230 | fstest.AssertTimeEqualWithPrecision(t, o.Remote(), tFile, tObj, time.Second) |
| 231 | |
| 232 | // check object not found |
| 233 | o, err = f.NewObject(context.Background(), "/not found.txt") |
| 234 | assert.Nil(t, o) |
| 235 | assert.Equal(t, fs.ErrorObjectNotFound, err) |
| 236 | } |
| 237 | |
| 238 | func TestNewObjectWithMetadata(t *testing.T) { |
| 239 | f := prepare(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…