@@ -39,7 +39,7 @@ func TestRun(t *testing.T) {
3939 workDir string
4040 resume bool
4141 params Params
42- includes selectorMap
42+ includes selectors
4343 setupFiles func (t * testing.T , tmpDir string )
4444 wantErr bool
4545 errContains string
@@ -140,7 +140,7 @@ func TestRun(t *testing.T) {
140140 cc .params = make (Params )
141141 }
142142 if cc .includes == nil {
143- cc .includes = make (selectorMap )
143+ cc .includes = make (selectors )
144144 }
145145
146146 err = cc .run (context .Background (), tt .args )
@@ -164,7 +164,7 @@ func TestFindTaskFile(t *testing.T) {
164164 tests := []struct {
165165 name string
166166 taskName string
167- includes selectorMap
167+ includes selectors
168168 setupFiles func (t * testing.T , tmpDir string )
169169 downloadedDirs []string // Directories to add to downloadedDirs
170170 wantErr bool
@@ -208,7 +208,7 @@ func TestFindTaskFile(t *testing.T) {
208208 {
209209 name : "task with matching selector" ,
210210 taskName : "filtered_task" ,
211- includes : selectorMap {
211+ includes : selectors {
212212 "env" : map [string ]bool {"prod" : true },
213213 },
214214 setupFiles : func (t * testing.T , tmpDir string ) {
@@ -222,7 +222,7 @@ func TestFindTaskFile(t *testing.T) {
222222 {
223223 name : "task with non-matching selector" ,
224224 taskName : "filtered_task" ,
225- includes : selectorMap {
225+ includes : selectors {
226226 "env" : map [string ]bool {"dev" : true },
227227 },
228228 setupFiles : func (t * testing.T , tmpDir string ) {
@@ -331,7 +331,7 @@ func TestFindTaskFile(t *testing.T) {
331331 includes : tt .includes ,
332332 }
333333 if cc .includes == nil {
334- cc .includes = make (selectorMap )
334+ cc .includes = make (selectors )
335335 }
336336 cc .includes .SetValue ("task_name" , tt .taskName )
337337
@@ -372,7 +372,7 @@ func TestFindExecuteRuleFiles(t *testing.T) {
372372 tests := []struct {
373373 name string
374374 resume bool
375- includes selectorMap
375+ includes selectors
376376 setupFiles func (t * testing.T , tmpDir string )
377377 downloadedDirs []string // Directories to add to downloadedDirs
378378 wantTokens int
@@ -406,7 +406,7 @@ func TestFindExecuteRuleFiles(t *testing.T) {
406406 {
407407 name : "exclude rule with non-matching selector" ,
408408 resume : false ,
409- includes : selectorMap {
409+ includes : selectors {
410410 "env" : map [string ]bool {"prod" : true },
411411 },
412412 setupFiles : func (t * testing.T , tmpDir string ) {
@@ -419,7 +419,7 @@ func TestFindExecuteRuleFiles(t *testing.T) {
419419 {
420420 name : "include rule with matching selector" ,
421421 resume : false ,
422- includes : selectorMap {
422+ includes : selectors {
423423 "env" : map [string ]bool {"prod" : true },
424424 },
425425 setupFiles : func (t * testing.T , tmpDir string ) {
@@ -479,7 +479,7 @@ func TestFindExecuteRuleFiles(t *testing.T) {
479479 {
480480 name : "bootstrap script should not run on excluded files" ,
481481 resume : false ,
482- includes : selectorMap {
482+ includes : selectors {
483483 "env" : map [string ]bool {"prod" : true },
484484 },
485485 setupFiles : func (t * testing.T , tmpDir string ) {
@@ -532,7 +532,7 @@ func TestFindExecuteRuleFiles(t *testing.T) {
532532 },
533533 }
534534 if cc .includes == nil {
535- cc .includes = make (selectorMap )
535+ cc .includes = make (selectors )
536536 }
537537
538538 // Set downloadedDirs if specified in test case
@@ -794,7 +794,7 @@ func TestWriteTaskFileContent(t *testing.T) {
794794 emitTaskFrontmatter : tt .emitTaskFrontmatter ,
795795 output : & output ,
796796 logOut : & logOut ,
797- includes : make (selectorMap ),
797+ includes : make (selectors ),
798798 }
799799
800800 // Parse task file first
@@ -861,16 +861,16 @@ func TestParseTaskFile(t *testing.T) {
861861 name string
862862 taskFile string
863863 setupFiles func (t * testing.T , tmpDir string ) string // returns task file path
864- initialIncludes selectorMap
865- expectedIncludes selectorMap // expected includes after parsing
864+ initialIncludes selectors
865+ expectedIncludes selectors // expected includes after parsing
866866 wantErr bool
867867 errContains string
868868 }{
869869 {
870870 name : "task without selectors field" ,
871871 taskFile : "task.md" ,
872- initialIncludes : make (selectorMap ),
873- expectedIncludes : make (selectorMap ),
872+ initialIncludes : make (selectors ),
873+ expectedIncludes : make (selectors ),
874874 setupFiles : func (t * testing.T , tmpDir string ) string {
875875 taskPath := filepath .Join (tmpDir , "task.md" )
876876 createMarkdownFile (t , taskPath ,
@@ -883,8 +883,8 @@ func TestParseTaskFile(t *testing.T) {
883883 {
884884 name : "task with selectors field" ,
885885 taskFile : "task.md" ,
886- initialIncludes : make (selectorMap ),
887- expectedIncludes : selectorMap {
886+ initialIncludes : make (selectors ),
887+ expectedIncludes : selectors {
888888 "language" : map [string ]bool {"Go" : true },
889889 "env" : map [string ]bool {"prod" : true },
890890 },
@@ -900,8 +900,8 @@ func TestParseTaskFile(t *testing.T) {
900900 {
901901 name : "task with selectors merges with existing includes" ,
902902 taskFile : "task.md" ,
903- initialIncludes : selectorMap {"existing" : map [string ]bool {"value" : true }},
904- expectedIncludes : selectorMap {
903+ initialIncludes : selectors {"existing" : map [string ]bool {"value" : true }},
904+ expectedIncludes : selectors {
905905 "existing" : map [string ]bool {"value" : true },
906906 "language" : map [string ]bool {"Python" : true },
907907 },
@@ -917,8 +917,8 @@ func TestParseTaskFile(t *testing.T) {
917917 {
918918 name : "task with array selector values" ,
919919 taskFile : "task.md" ,
920- initialIncludes : make (selectorMap ),
921- expectedIncludes : selectorMap {
920+ initialIncludes : make (selectors ),
921+ expectedIncludes : selectors {
922922 "rule_name" : map [string ]bool {"rule1" : true , "rule2" : true },
923923 },
924924 setupFiles : func (t * testing.T , tmpDir string ) string {
@@ -933,8 +933,8 @@ func TestParseTaskFile(t *testing.T) {
933933 {
934934 name : "selectors from -s flag and task file are additive" ,
935935 taskFile : "task.md" ,
936- initialIncludes : selectorMap {"var" : map [string ]bool {"arg1" : true }},
937- expectedIncludes : selectorMap {
936+ initialIncludes : selectors {"var" : map [string ]bool {"arg1" : true }},
937+ expectedIncludes : selectors {
938938 "var" : map [string ]bool {"arg1" : true , "arg2" : true },
939939 },
940940 setupFiles : func (t * testing.T , tmpDir string ) string {
@@ -949,8 +949,8 @@ func TestParseTaskFile(t *testing.T) {
949949 {
950950 name : "task with integer selector value" ,
951951 taskFile : "task.md" ,
952- initialIncludes : make (selectorMap ),
953- expectedIncludes : selectorMap {
952+ initialIncludes : make (selectors ),
953+ expectedIncludes : selectors {
954954 "version" : map [string ]bool {"42" : true },
955955 },
956956 setupFiles : func (t * testing.T , tmpDir string ) string {
@@ -965,7 +965,7 @@ func TestParseTaskFile(t *testing.T) {
965965 {
966966 name : "task with invalid selectors field type" ,
967967 taskFile : "task.md" ,
968- initialIncludes : make (selectorMap ),
968+ initialIncludes : make (selectors ),
969969 setupFiles : func (t * testing.T , tmpDir string ) string {
970970 taskPath := filepath .Join (tmpDir , "task.md" )
971971 createMarkdownFile (t , taskPath ,
@@ -988,7 +988,7 @@ func TestParseTaskFile(t *testing.T) {
988988 includes : tt .initialIncludes ,
989989 }
990990 if cc .includes == nil {
991- cc .includes = make (selectorMap )
991+ cc .includes = make (selectors )
992992 }
993993
994994 err := cc .parseTaskFile ()
@@ -1156,7 +1156,7 @@ func TestTaskSelectorsFilterRulesByRuleName(t *testing.T) {
11561156 var output , logOut bytes.Buffer
11571157 cc := & codingContext {
11581158 workDir : tmpDir ,
1159- includes : make (selectorMap ),
1159+ includes : make (selectors ),
11601160 output : & output ,
11611161 logOut : & logOut ,
11621162 cmdRunner : func (cmd * exec.Cmd ) error {
@@ -1220,7 +1220,7 @@ func TestTaskFileWalker(t *testing.T) {
12201220 tests := []struct {
12211221 name string
12221222 taskName string
1223- includes selectorMap
1223+ includes selectors
12241224 fileInfo fileInfoMock
12251225 filePath string
12261226 fileContent string // frontmatter + content
@@ -1303,7 +1303,7 @@ func TestTaskFileWalker(t *testing.T) {
13031303 matchingTaskFile : tt .existingMatch ,
13041304 }
13051305 if cc .includes == nil {
1306- cc .includes = make (selectorMap )
1306+ cc .includes = make (selectors )
13071307 }
13081308 cc .includes .SetValue ("task_name" , tt .taskName )
13091309
@@ -1335,7 +1335,7 @@ func TestTaskFileWalker(t *testing.T) {
13351335func TestRuleFileWalker (t * testing.T ) {
13361336 tests := []struct {
13371337 name string
1338- includes selectorMap
1338+ includes selectors
13391339 fileInfo fileInfoMock
13401340 filePath string
13411341 fileContent string
@@ -1373,7 +1373,7 @@ func TestRuleFileWalker(t *testing.T) {
13731373 },
13741374 {
13751375 name : "exclude rule with non-matching selector" ,
1376- includes : selectorMap {"env" : map [string ]bool {"prod" : true }},
1376+ includes : selectors {"env" : map [string ]bool {"prod" : true }},
13771377 fileInfo : fileInfoMock {isDir : false , name : "rule.md" },
13781378 filePath : "rule.md" ,
13791379 fileContent : "---\n env: dev\n ---\n # Dev Rule" ,
@@ -1383,7 +1383,7 @@ func TestRuleFileWalker(t *testing.T) {
13831383 },
13841384 {
13851385 name : "include rule with matching selector" ,
1386- includes : selectorMap {"env" : map [string ]bool {"prod" : true }},
1386+ includes : selectors {"env" : map [string ]bool {"prod" : true }},
13871387 fileInfo : fileInfoMock {isDir : false , name : "rule.md" },
13881388 filePath : "rule.md" ,
13891389 fileContent : "---\n env: prod\n ---\n # Prod Rule" ,
@@ -1418,7 +1418,7 @@ func TestRuleFileWalker(t *testing.T) {
14181418 },
14191419 }
14201420 if cc .includes == nil {
1421- cc .includes = make (selectorMap )
1421+ cc .includes = make (selectors )
14221422 }
14231423
14241424 walker := cc .ruleFileWalker (context .Background ())
0 commit comments