8
8
"testing"
9
9
10
10
"github.com/go-git/go-billy/v6"
11
- "github.com/go-git/go-billy/v6/embedfs_testdata "
11
+ "github.com/go-git/go-billy/v6/embedfs/internal/testdata "
12
12
"github.com/stretchr/testify/assert"
13
13
"github.com/stretchr/testify/require"
14
14
)
@@ -38,7 +38,7 @@ func TestOpen(t *testing.T) {
38
38
39
39
for _ , tc := range tests {
40
40
t .Run (tc .name , func (t * testing.T ) {
41
- fs := New (embedfs_testdata .GetTestData ())
41
+ fs := New (testdata .GetTestData ())
42
42
43
43
var got []byte
44
44
f , err := fs .Open (tc .name )
@@ -109,7 +109,7 @@ func TestOpenFileFlags(t *testing.T) {
109
109
110
110
for _ , tc := range tests {
111
111
t .Run (tc .name , func (t * testing.T ) {
112
- fs := New (embedfs_testdata .GetTestData ())
112
+ fs := New (testdata .GetTestData ())
113
113
114
114
_ , err := fs .OpenFile (tc .file , tc .flag , 0o700 )
115
115
if tc .wantErr != "" {
@@ -151,7 +151,7 @@ func TestStat(t *testing.T) {
151
151
152
152
for _ , tc := range tests {
153
153
t .Run (tc .name , func (t * testing.T ) {
154
- fs := New (embedfs_testdata .GetTestData ())
154
+ fs := New (testdata .GetTestData ())
155
155
156
156
fi , err := fs .Stat (tc .name )
157
157
if tc .wantErr {
@@ -180,20 +180,20 @@ func TestReadDir(t *testing.T) {
180
180
{
181
181
name : "testdata" ,
182
182
path : "testdata" ,
183
- fs : embedfs_testdata .GetTestData (),
183
+ fs : testdata .GetTestData (),
184
184
want : []string {"empty.txt" , "file1.txt" , "file2.txt" , "subdir" },
185
185
},
186
186
{
187
187
name : "empty path" ,
188
188
path : "" ,
189
- fs : embedfs_testdata .GetTestData (),
190
- want : []string {},
191
- wantErr : true ,
189
+ fs : testdata .GetTestData (),
190
+ want : []string {"testdata" },
191
+ wantErr : false ,
192
192
},
193
193
{
194
194
name : "root path" ,
195
195
path : "/" ,
196
- fs : embedfs_testdata .GetTestData (),
196
+ fs : testdata .GetTestData (),
197
197
want : []string {"testdata" },
198
198
},
199
199
}
@@ -228,7 +228,7 @@ func TestReadDir(t *testing.T) {
228
228
func TestUnsupported (t * testing.T ) {
229
229
t .Parallel ()
230
230
231
- fs := New (embedfs_testdata .GetTestData ())
231
+ fs := New (testdata .GetTestData ())
232
232
233
233
_ , err := fs .Create ("test" )
234
234
require .ErrorIs (t , err , billy .ErrReadOnly )
@@ -246,7 +246,7 @@ func TestUnsupported(t *testing.T) {
246
246
func TestFileUnsupported (t * testing.T ) {
247
247
t .Parallel ()
248
248
249
- fs := New (embedfs_testdata .GetTestData ())
249
+ fs := New (testdata .GetTestData ())
250
250
251
251
f , err := fs .Open ("testdata/file1.txt" )
252
252
require .NoError (t , err )
@@ -260,7 +260,7 @@ func TestFileUnsupported(t *testing.T) {
260
260
}
261
261
262
262
func TestFileSeek (t * testing.T ) {
263
- fs := New (embedfs_testdata .GetTestData ())
263
+ fs := New (testdata .GetTestData ())
264
264
265
265
f , err := fs .Open ("testdata/file2.txt" )
266
266
require .NoError (t , err )
@@ -325,7 +325,7 @@ func TestJoin(t *testing.T) {
325
325
326
326
for _ , tc := range tests {
327
327
t .Run (tc .name , func (t * testing.T ) {
328
- fs := New (embedfs_testdata .GetTestData ())
328
+ fs := New (testdata .GetTestData ())
329
329
330
330
got := fs .Join (tc .path ... )
331
331
assert .Equal (t , tc .want , got )
@@ -338,19 +338,19 @@ func TestJoin(t *testing.T) {
338
338
func TestEmbedfs_ComprehensiveOpen (t * testing.T ) {
339
339
t .Parallel ()
340
340
341
- fs := New (embedfs_testdata .GetTestData ())
341
+ fs := New (testdata .GetTestData ())
342
342
343
343
// Test opening existing embedded file with content
344
344
f , err := fs .Open ("/testdata/file1.txt" )
345
345
require .NoError (t , err )
346
- assert .Equal (t , "file1.txt" , f .Name ())
346
+ assert .Equal (t , "testdata/ file1.txt" , f .Name ())
347
347
require .NoError (t , f .Close ())
348
348
}
349
349
350
350
func TestEmbedfs_ComprehensiveRead (t * testing.T ) {
351
351
t .Parallel ()
352
352
353
- fs := New (embedfs_testdata .GetTestData ())
353
+ fs := New (testdata .GetTestData ())
354
354
355
355
f , err := fs .Open ("/testdata/file1.txt" )
356
356
require .NoError (t , err )
@@ -366,7 +366,7 @@ func TestEmbedfs_ComprehensiveRead(t *testing.T) {
366
366
func TestEmbedfs_NestedFileOperations (t * testing.T ) {
367
367
t .Parallel ()
368
368
369
- fs := New (embedfs_testdata .GetTestData ())
369
+ fs := New (testdata .GetTestData ())
370
370
371
371
// Test nested file read
372
372
f , err := fs .Open ("/testdata/subdir/nested.txt" )
@@ -382,7 +382,7 @@ func TestEmbedfs_NestedFileOperations(t *testing.T) {
382
382
func TestEmbedfs_PathNormalization (t * testing.T ) {
383
383
t .Parallel ()
384
384
385
- fs := New (embedfs_testdata .GetTestData ())
385
+ fs := New (testdata .GetTestData ())
386
386
387
387
// Test that our path normalization works across all methods
388
388
tests := []struct {
@@ -411,7 +411,7 @@ func TestEmbedfs_PathNormalization(t *testing.T) {
411
411
func TestFile_ReadAt (t * testing.T ) {
412
412
t .Parallel ()
413
413
414
- fs := New (embedfs_testdata .GetTestData ())
414
+ fs := New (testdata .GetTestData ())
415
415
416
416
f , err := fs .Open ("/testdata/file1.txt" )
417
417
require .NoError (t , err )
@@ -463,7 +463,7 @@ func TestFile_ReadAt(t *testing.T) {
463
463
func TestFile_Close (t * testing.T ) {
464
464
t .Parallel ()
465
465
466
- fs := New (embedfs_testdata .GetTestData ())
466
+ fs := New (testdata .GetTestData ())
467
467
468
468
f , err := fs .Open ("/testdata/file1.txt" )
469
469
require .NoError (t , err )
@@ -487,7 +487,7 @@ func TestFile_Close(t *testing.T) {
487
487
func TestFile_LockUnlock (t * testing.T ) {
488
488
t .Parallel ()
489
489
490
- fs := New (embedfs_testdata .GetTestData ())
490
+ fs := New (testdata .GetTestData ())
491
491
492
492
f , err := fs .Open ("/testdata/file1.txt" )
493
493
require .NoError (t , err )
0 commit comments