nativemodel_windows_test.go 614 B

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