File tree Expand file tree Collapse file tree 3 files changed +5
-11
lines changed
Expand file tree Collapse file tree 3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ func createTestCommand() cli.Command {
6363 Name : "dir" ,
6464 Usage : "Execute all test files in a directory sorted by file name, this is not recursive - e.g. /path/to/test_files/" ,
6565 },
66- cli.StringFlag {
66+ cli.StringSliceFlag {
6767 Name : "filter" ,
6868 Usage : `Filter tests by a given regex pattern. Tests are filtered by its title.
6969
7070Example:
7171test commander.yaml --filter="my test"
7272
73- Apply multiple filters separated by commas :
74- test commander.yaml --filter=filter1, filter2
73+ Apply multiple filters:
74+ test commander.yaml --filter=filter1 --filter= filter2
7575` ,
7676 },
7777 },
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ tests:
102102 exit-code : 0
103103
104104 test mulitple filters :
105- command : ./commander test integration/unix/filter_test.yaml --filter="executed$, should be ignored"
105+ command : ./commander test integration/unix/filter_test.yaml --filter="executed$" --filter=" should be ignored"
106106 stdout :
107107 contains :
108108 - ✓ [local] should be executed
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package app
22
33import (
44 "github.com/urfave/cli"
5- "strings"
65)
76
87const (
@@ -23,16 +22,11 @@ type AddCommandContext struct {
2322
2423//NewAddContextFromCli is a constructor which creates the context
2524func NewAddContextFromCli (c * cli.Context ) AddCommandContext {
26- filters := strings .Split (c .String ("filter" ), "," )
27- if filters [0 ] == "" {
28- filters = make ([]string , 0 )
29- }
30-
3125 return AddCommandContext {
3226 Verbose : c .Bool ("verbose" ),
3327 NoColor : c .Bool ("no-color" ),
3428 Dir : c .Bool ("dir" ),
3529 Concurrent : c .Int ("concurrent" ),
36- Filters : filters ,
30+ Filters : c . StringSlice ( "filter" ) ,
3731 }
3832}
You can’t perform that action at this time.
0 commit comments