nativemodel_windows_test.go 615 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2016 The Protocol Authors.
  2. package protocol
  3. import "testing"
  4. import "reflect"
  5. func TestFixupFiles(t *testing.T) {
  6. files := []FileInfo{
  7. {Name: "foo/bar"},
  8. {Name: `foo\bar`},
  9. {Name: "foo/baz"},
  10. {Name: "foo/quux"},
  11. {Name: `foo\fail`},
  12. }
  13. // Filenames should be slash converted, except files which already have
  14. // backslashes in them which are instead filtered out.
  15. expected := []FileInfo{
  16. {Name: `foo\bar`},
  17. {Name: `foo\baz`},
  18. {Name: `foo\quux`},
  19. }
  20. fixed := fixupFiles(files)
  21. if !reflect.DeepEqual(fixed, expected) {
  22. t.Errorf("Got %v, expected %v", fixed, expected)
  23. }
  24. }