| 1304 | } |
| 1305 | |
| 1306 | func TestFindFiles_RecursesIntoSubdirectories(t *testing.T) { |
| 1307 | t.Parallel() |
| 1308 | p := script.FindFiles("testdata/multiple_files_with_subdirectory") |
| 1309 | if p.Error() != nil { |
| 1310 | t.Fatal(p.Error()) |
| 1311 | } |
| 1312 | p.SetError(nil) // else p.String() would be a no-op |
| 1313 | // Expect result to use this platform's path separator |
| 1314 | want := filepath.Clean("testdata/multiple_files_with_subdirectory/1.txt\ntestdata/multiple_files_with_subdirectory/2.txt\ntestdata/multiple_files_with_subdirectory/3.tar.zip\ntestdata/multiple_files_with_subdirectory/dir/.hidden\ntestdata/multiple_files_with_subdirectory/dir/1.txt\ntestdata/multiple_files_with_subdirectory/dir/2.txt\n") |
| 1315 | got, err := p.String() |
| 1316 | if err != nil { |
| 1317 | t.Fatal(err) |
| 1318 | } |
| 1319 | if !cmp.Equal(want, got) { |
| 1320 | t.Fatal(cmp.Diff(want, got)) |
| 1321 | } |
| 1322 | } |
| 1323 | |
| 1324 | func TestFindFiles_InNonexistentPathReturnsError(t *testing.T) { |
| 1325 | t.Parallel() |