Update old and add new tests

This commit is contained in:
2025-03-27 23:28:49 +01:00
parent f91c2b4795
commit 5d10178bf9
5 changed files with 685 additions and 131 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"modify/utils"
"os"
"path/filepath"
"testing"
@@ -76,9 +77,14 @@ func TestGlobExpansion(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
files, err := expandFilePatterns(tc.patterns)
// Convert string patterns to map[string]struct{} for ExpandGLobs
patternMap := make(map[string]struct{})
for _, pattern := range tc.patterns {
patternMap[pattern] = struct{}{}
}
files, err := utils.ExpandGLobs(patternMap)
if err != nil {
t.Fatalf("expandFilePatterns failed: %v", err)
t.Fatalf("ExpandGLobs failed: %v", err)
}
if len(files) != tc.expected {