jhult commented on code in PR #263:
URL: https://github.com/apache/skywalking-eyes/pull/263#discussion_r3037318588


##########
pkg/header/check_test.go:
##########
@@ -273,3 +273,70 @@ func TestListFilesWithWorktreeDetachedHEAD(t *testing.T) {
                t.Error("Expected to find files with valid commit")
        }
 }
+
+func TestMatchPaths(t *testing.T) {
+       tests := []struct {
+               name     string
+               file     string
+               patterns []string
+               expected bool
+       }{
+               {
+                       name:     "Exact file match",
+                       file:     "test.go",
+                       patterns: []string{"test.go"},
+                       expected: true,
+               },
+               {
+                       name:     "Glob pattern match",
+                       file:     "test.go",
+                       patterns: []string{"*.go"},
+                       expected: true,
+               },
+               {
+                       name:     "Double-star glob pattern match",
+                       file:     "pkg/header/check.go",
+                       patterns: []string{"**/*.go"},
+                       expected: true,
+               },
+               {
+                       name:     "Multiple patterns with match",
+                       file:     "test.go",
+                       patterns: []string{"*.java", "*.go", "*.py"},
+                       expected: true,
+               },
+               {
+                       name:     "Multiple patterns without match",
+                       file:     "test.go",
+                       patterns: []string{"*.java", "*.py"},
+                       expected: false,
+               },
+               {
+                       name:     "Directory pattern with trailing slash",
+                       file:     "pkg/header/check.go",
+                       patterns: []string{"pkg/header/"},
+                       expected: false,

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to