66 "io/ioutil"
77 "os"
88 "path/filepath"
9+ "runtime"
910 "strings"
1011 "testing"
1112 "time"
@@ -20,7 +21,14 @@ import (
2021// - symlink test
2122// - hardlink test
2223
24+ func skipDiffTestOnWindows (t * testing.T ) {
25+ if runtime .GOOS == "windows" {
26+ t .Skip ("diff implementation is incomplete on windows" )
27+ }
28+ }
29+
2330func TestSimpleDiff (t * testing.T ) {
31+ skipDiffTestOnWindows (t )
2432 l1 := fstest .Apply (
2533 fstest .CreateDir ("/etc" , 0755 ),
2634 fstest .CreateFile ("/etc/hosts" , []byte ("mydomain 10.0.0.1" ), 0644 ),
@@ -49,6 +57,7 @@ func TestSimpleDiff(t *testing.T) {
4957}
5058
5159func TestDirectoryReplace (t * testing.T ) {
60+ skipDiffTestOnWindows (t )
5261 l1 := fstest .Apply (
5362 fstest .CreateDir ("/dir1" , 0755 ),
5463 fstest .CreateFile ("/dir1/f1" , []byte ("#####" ), 0644 ),
@@ -109,6 +118,7 @@ func TestFileReplace(t *testing.T) {
109118}
110119
111120func TestParentDirectoryPermission (t * testing.T ) {
121+ skipDiffTestOnWindows (t )
112122 l1 := fstest .Apply (
113123 fstest .CreateDir ("/dir1" , 0700 ),
114124 fstest .CreateDir ("/dir2" , 0751 ),
@@ -134,6 +144,7 @@ func TestParentDirectoryPermission(t *testing.T) {
134144 }
135145}
136146func TestUpdateWithSameTime (t * testing.T ) {
147+ skipDiffTestOnWindows (t )
137148 tt := time .Now ().Truncate (time .Second )
138149 t1 := tt .Add (5 * time .Nanosecond )
139150 t2 := tt .Add (6 * time .Nanosecond )
@@ -322,20 +333,20 @@ func changesString(c []TestChange) string {
322333func Add (p string ) TestChange {
323334 return TestChange {
324335 Kind : ChangeKindAdd ,
325- Path : p ,
336+ Path : filepath . FromSlash ( p ) ,
326337 }
327338}
328339
329340func Delete (p string ) TestChange {
330341 return TestChange {
331342 Kind : ChangeKindDelete ,
332- Path : p ,
343+ Path : filepath . FromSlash ( p ) ,
333344 }
334345}
335346
336347func Modify (p string ) TestChange {
337348 return TestChange {
338349 Kind : ChangeKindModify ,
339- Path : p ,
350+ Path : filepath . FromSlash ( p ) ,
340351 }
341352}
0 commit comments