Skip to content

Commit

Permalink
add test to highlight the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
umbynos committed Jul 25, 2024
1 parent 75e13b1 commit 42d1102
Showing 1 changed file with 16 additions and 0 deletions.
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")
}

0 comments on commit 42d1102

Please sign in to comment.