Skip to content

Commit

Permalink
Change step_create_cdrom_tests to pass on Windows (#114)
Browse files Browse the repository at this point in the history
The tests were relying on unix paths "/" while on Windows we have "\"
and tests were failing in checkFiles with the such messages as:

unexpected file: subfolder\meta-data
  • Loading branch information
tempora-mutantur committed Jul 6, 2022
1 parent e6c35e7 commit d177a80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions multistep/commonsteps/step_create_cdrom_test.go
Expand Up @@ -52,21 +52,21 @@ func checkFiles(t *testing.T, rootFolder string, expected map[string]string) {

if !d.IsDir() {
name, _ := filepath.Rel(rootFolder, path)

expectedContent, ok := expected[name]
nameSlashSafe := filepath.ToSlash(name)
expectedContent, ok := expected[nameSlashSafe]
if !ok {
t.Fatalf("unexpected file: %s", name)
t.Fatalf("unexpected file: %s", nameSlashSafe)
}

content, err := ioutil.ReadFile(path)
if err != nil {
t.Fatalf("reading file: %s", err)
}
if string(content) != expectedContent {
t.Fatalf("unexpected content: %s", name)
t.Fatalf("unexpected content: %s", nameSlashSafe)
}

delete(expected, name)
delete(expected, nameSlashSafe)
}

return nil
Expand Down

0 comments on commit d177a80

Please sign in to comment.