- s.setDefaults()
-
- // Deterministic temporary symlink names
- rand.Seed(0)
-
- var changed bool
- err := s.syncFile(tc.file, &changed)
- // Ugly but the simplest way to compare errors (including nil)
- if fmt.Sprintf("%s", err) != fmt.Sprintf("%s", tc.expErr) {
- t.Errorf("%s: err = %#v, want %#v",
- tc.name, err, tc.expErr)
- }
- dbg := res.Wait()
- // Remove random file names from result
- for i, x := range dbg {
- dbg[i] = randFilesRegexp.ReplaceAllString(x, `RND"`)
- }
- if !reflect.DeepEqual(tc.expDbg, dbg) {
- t.Errorf("%s: dbg: %s", tc.name,
- cmp.Diff(tc.expDbg, dbg))
- }
-
- files, err := ft.WalkDir(path)
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(tc.expFiles, files) {
- t.Errorf("%s: files: %s", tc.name,
- cmp.Diff(tc.expFiles, files))
- }
-
- if tc.expChanged != changed {
- t.Errorf("%s: changed = %#v, want %#v",
- tc.name, changed, tc.expChanged)
- }
- if !reflect.DeepEqual(tc.expResp, s.resp) {
- t.Errorf("%s: resp: %s", tc.name,
- cmp.Diff(tc.expResp, s.resp))
- }