@@ -18,6 +18,7 @@ package archivefs_test
1818import (
1919 "fmt"
2020 "io"
21+ "os"
2122 "path/filepath"
2223 "testing"
2324
@@ -31,6 +32,13 @@ func TestArchivefsPath(t *testing.T) {
3132 var entries []archivefs.Entry
3233 var err error
3334
35+ // get working directory for test. we need this so we can modify the testing
36+ // path for comparison with result from the archivefs.Set() function
37+ wd , err := os .Getwd ()
38+ test .ExpectSuccess (t , err )
39+ wd , err = filepath .Abs (wd )
40+ test .ExpectSuccess (t , err )
41+
3442 // non-existant file
3543 path = "foo"
3644 err = afs .Set (path , false )
@@ -41,7 +49,7 @@ func TestArchivefsPath(t *testing.T) {
4149 path = "testdir"
4250 err = afs .Set (path , false )
4351 test .ExpectSuccess (t , err )
44- test .ExpectEquality (t , afs .String (), path )
52+ test .ExpectEquality (t , afs .String (), filepath . Join ( wd , path ) )
4553 test .ExpectSuccess (t , afs .IsDir ())
4654 test .ExpectSuccess (t , ! afs .InArchive ())
4755
@@ -61,7 +69,7 @@ func TestArchivefsPath(t *testing.T) {
6169 path = filepath .Join ("testdir" , "testfile" )
6270 err = afs .Set (path , false )
6371 test .ExpectSuccess (t , err )
64- test .ExpectEquality (t , afs .String (), path )
72+ test .ExpectEquality (t , afs .String (), filepath . Join ( wd , path ) )
6573 test .ExpectSuccess (t , ! afs .IsDir ())
6674 test .ExpectSuccess (t , ! afs .InArchive ())
6775
@@ -76,7 +84,7 @@ func TestArchivefsPath(t *testing.T) {
7684 path = filepath .Join ("testdir" , "testarchive.zip" )
7785 err = afs .Set (path , false )
7886 test .ExpectSuccess (t , err )
79- test .ExpectEquality (t , afs .String (), path )
87+ test .ExpectEquality (t , afs .String (), filepath . Join ( wd , path ) )
8088 test .ExpectSuccess (t , afs .IsDir ())
8189 test .ExpectSuccess (t , afs .InArchive ())
8290
@@ -90,15 +98,15 @@ func TestArchivefsPath(t *testing.T) {
9098 path = filepath .Join ("testdir" , "testarchive.zip" , "archivefile1" )
9199 err = afs .Set (path , false )
92100 test .ExpectSuccess (t , err )
93- test .ExpectEquality (t , afs .String (), path )
101+ test .ExpectEquality (t , afs .String (), filepath . Join ( wd , path ) )
94102 test .ExpectSuccess (t , ! afs .IsDir ())
95103 test .ExpectSuccess (t , afs .InArchive ())
96104
97105 // directory a real archive
98106 path = filepath .Join ("testdir" , "testarchive.zip" , "archivedir" )
99107 err = afs .Set (path , false )
100108 test .ExpectSuccess (t , err )
101- test .ExpectEquality (t , afs .String (), path )
109+ test .ExpectEquality (t , afs .String (), filepath . Join ( wd , path ) )
102110 test .ExpectSuccess (t , afs .IsDir ())
103111 test .ExpectSuccess (t , afs .InArchive ())
104112
@@ -112,7 +120,7 @@ func TestArchivefsPath(t *testing.T) {
112120 path = filepath .Join ("testdir" , "testarchive.zip" , "archivedir" , "archivefile3" )
113121 err = afs .Set (path , false )
114122 test .ExpectSuccess (t , err )
115- test .ExpectEquality (t , afs .String (), path )
123+ test .ExpectEquality (t , afs .String (), filepath . Join ( wd , path ) )
116124 test .ExpectSuccess (t , ! afs .IsDir ())
117125 test .ExpectSuccess (t , afs .InArchive ())
118126}
0 commit comments