@@ -176,7 +176,7 @@ func TestFindTaskFile(t *testing.T) {
176176func TestDotEnv (t * testing.T ) {
177177 var taskFile , cliArgs string
178178
179- config , err := NewTaskConfig (taskFile , cliArgs )
179+ config , err := NewTaskConfig (taskFile , cliArgs , false )
180180 if err != nil {
181181 panic (err )
182182 }
@@ -301,7 +301,7 @@ func TestTemplates(t *testing.T) {
301301 expected := regexp .MustCompile (cliArgs )
302302 wd , _ := os .Getwd ()
303303 path , _ := findTaskFile (wd , "tasks.toml" )
304- config , _ := NewTaskConfig (path , cliArgs )
304+ config , _ := NewTaskConfig (path , cliArgs , false )
305305 out := new (bytes.Buffer )
306306 exec := Executor {
307307 Stdout : out ,
@@ -312,3 +312,22 @@ func TestTemplates(t *testing.T) {
312312 t .Errorf ("Expected '%s' to match '%s'" , cliArgs , out .String ())
313313 }
314314}
315+
316+ // when building --list output for tasks that use CLI_ARGS test that placeholder
317+ // text is inserted when CLI_ARGS arent provided
318+ func TestTemplatesWithPlaceholders (t * testing.T ) {
319+ placeholder := "{{.CLI_ARGS}}"
320+ expected := regexp .MustCompile (placeholder )
321+ wd , _ := os .Getwd ()
322+ path , _ := findTaskFile (wd , "tasks.toml" )
323+ config , _ := NewTaskConfig (path , "" , true )
324+ out := new (bytes.Buffer )
325+ exec := Executor {
326+ Stdout : out ,
327+ }
328+
329+ exec .RunTasks (config , & []string {"template" })
330+ if ! expected .Match (out .Bytes ()) {
331+ t .Errorf ("Expected '%s' to match '%s'" , placeholder , out .String ())
332+ }
333+ }
0 commit comments