Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [
var immediateSubprojects []Type
for _, subprojectsFolderName := range subprojectsFolderNames {
subprojectsPath := superproject.Path.Join(subprojectsFolderName)
if subprojectsPath.Exist() {
if subprojectsPath.Exist() && subprojectsPath.IsDir() {
directoryListing, err := subprojectsPath.ReadDir()
if err != nil {
panic(err)
Expand Down
16 changes: 16 additions & 0 deletions internal/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,3 +429,19 @@ func TestFindProjects(t *testing.T) {
}
}
}

func TestExamplefile(t *testing.T) {
// Set up directory structure of test library.
libraryPath, err := paths.TempDir().MkTempDir("TestExampleFile")
defer libraryPath.RemoveAll() // Clean up after the test.
require.Nil(t, err)
err = libraryPath.Join("TestExample.h").WriteFile([]byte{})
require.Nil(t, err)
// Create an example file in the library folder. This should not cause a panic and should be ignored since it's not a folder containing the examples
err = libraryPath.Join("example").WriteFile([]byte{})
require.Nil(t, err)

configuration.Initialize(test.ConfigurationFlags(), []string{libraryPath.String()})

assert.NotPanics(t, func() { FindProjects() }, "Example file should not cause panic")
}