Skip to content

Commit 42d1102

Browse files
committed
add test to highlight the bug
1 parent 75e13b1 commit 42d1102

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: internal/project/project_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,19 @@ func TestFindProjects(t *testing.T) {
429429
}
430430
}
431431
}
432+
433+
func TestExamplefile(t *testing.T) {
434+
// Set up directory structure of test library.
435+
libraryPath, err := paths.TempDir().MkTempDir("TestExampleFile")
436+
defer libraryPath.RemoveAll() // Clean up after the test.
437+
require.Nil(t, err)
438+
err = libraryPath.Join("TestExample.h").WriteFile([]byte{})
439+
require.Nil(t, err)
440+
// 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
441+
err = libraryPath.Join("example").WriteFile([]byte{})
442+
require.Nil(t, err)
443+
444+
configuration.Initialize(test.ConfigurationFlags(), []string{libraryPath.String()})
445+
446+
assert.NotPanics(t, func() { FindProjects() }, "Example file should not cause panic")
447+
}

0 commit comments

Comments
 (0)