(t *testing.T)
| 182 | } |
| 183 | |
| 184 | func TestNewObject(t *testing.T) { |
| 185 | f := prepare(t) |
| 186 | |
| 187 | o, err := f.NewObject(context.Background(), "four/under four.txt") |
| 188 | require.NoError(t, err) |
| 189 | |
| 190 | assert.Equal(t, "four/under four.txt", o.Remote()) |
| 191 | assert.Equal(t, int64(8+lineEndSize), o.Size()) |
| 192 | _, ok := o.(*Object) |
| 193 | assert.True(t, ok) |
| 194 | |
| 195 | // Test the time is correct on the object |
| 196 | |
| 197 | tObj := o.ModTime(context.Background()) |
| 198 | |
| 199 | fi, err := os.Stat(filepath.Join(filesPath, "four", "under four.txt")) |
| 200 | require.NoError(t, err) |
| 201 | tFile := fi.ModTime() |
| 202 | |
| 203 | fstest.AssertTimeEqualWithPrecision(t, o.Remote(), tFile, tObj, time.Second) |
| 204 | |
| 205 | // check object not found |
| 206 | o, err = f.NewObject(context.Background(), "not found.txt") |
| 207 | assert.Nil(t, o) |
| 208 | assert.Equal(t, fs.ErrorObjectNotFound, err) |
| 209 | } |
| 210 | |
| 211 | func TestNewObjectWithLeadingSlash(t *testing.T) { |
| 212 | f := prepare(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…