Skip to content

Commit

Permalink
Add test coverage for callgraph finder file exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-debricked authored and ProgHaj committed Oct 20, 2023
1 parent d2048f9 commit 5082b92
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions internal/callgraph/finder/finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,23 @@ func TestFindFilesErr(t *testing.T) {
assert.NotNil(t, err)
assert.Empty(t, files)
}

func TestFindFilesExcluded(t *testing.T) {
f := Finder{}
project_path, _ := filepath.Abs("testdata/test_project")
files, err := f.FindFiles([]string{project_path}, nil)
assert.Nil(t, err)
assert.Len(t, files, 2)
files, err = f.FindFiles([]string{project_path}, []string{"**/excluded_folder/**"})
assert.Nil(t, err)
assert.Len(t, files, 1)
files, err = f.FindFiles([]string{project_path}, []string{"excluded_folder"})
assert.Nil(t, err)
assert.Len(t, files, 2)
files, err = f.FindFiles([]string{project_path}, []string{"**/excluded*/**"})
assert.Nil(t, err)
assert.Len(t, files, 1)
files, err = f.FindFiles([]string{project_path}, []string{"**/excluded_file.txt"})
assert.Nil(t, err)
assert.Len(t, files, 1)
}
Empty file.
Empty file.

0 comments on commit 5082b92

Please sign in to comment.