@@ -474,10 +474,58 @@ func TestLabelInList(t *testing.T) {
474
474
Stderr : & buff ,
475
475
}
476
476
assert .NoError (t , e .Setup ())
477
- e .PrintTasksHelp ()
477
+ e .PrintTasksHelp (false )
478
478
assert .Contains (t , buff .String (), "foobar" )
479
479
}
480
480
481
+ // task -al case 1: listAll list all tasks
482
+ func TestListAllShowsNoDesc (t * testing.T ) {
483
+ const dir = "testdata/list_mixed_desc"
484
+
485
+ var buff bytes.Buffer
486
+ e := task.Executor {
487
+ Dir : dir ,
488
+ Stdout : & buff ,
489
+ Stderr : & buff ,
490
+ }
491
+
492
+ assert .NoError (t , e .Setup ())
493
+
494
+ var title string
495
+ e .PrintTasksHelp (true )
496
+ for _ , title = range []string {
497
+ "foo" ,
498
+ "voo" ,
499
+ "doo" ,
500
+ } {
501
+ assert .Contains (t , buff .String (), title )
502
+ }
503
+ }
504
+
505
+ // task -al case 2: !listAll list some tasks (only those with desc)
506
+ func TestListCanListDescOnly (t * testing.T ) {
507
+ const dir = "testdata/list_mixed_desc"
508
+
509
+ var buff bytes.Buffer
510
+ e := task.Executor {
511
+ Dir : dir ,
512
+ Stdout : & buff ,
513
+ Stderr : & buff ,
514
+ }
515
+
516
+ assert .NoError (t , e .Setup ())
517
+ e .PrintTasksHelp (false )
518
+
519
+ var title string
520
+ assert .Contains (t , buff .String (), "foo" )
521
+ for _ , title = range []string {
522
+ "voo" ,
523
+ "doo" ,
524
+ } {
525
+ assert .NotContains (t , buff .String (), title )
526
+ }
527
+ }
528
+
481
529
func TestStatusVariables (t * testing.T ) {
482
530
const dir = "testdata/status_vars"
483
531
0 commit comments