diff options
| author | Eyal Posener <[email protected]> | 2017-05-06 20:07:50 +0300 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2017-05-06 20:24:53 +0300 |
| commit | f46c5f8a2808c5ade2f0b805a473765960250fe4 (patch) | |
| tree | 1165a98f6d513e878e74490d0bb8b97bd0ae5feb /run_test.go | |
| parent | dc4c327ae8cd5602ae10eeabde9bdf6fa5624286 (diff) | |
Change Predicate to be of function type
Diffstat (limited to 'run_test.go')
| -rw-r--r-- | run_test.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/run_test.go b/run_test.go index 0fe52d6..4cbf36d 100644 --- a/run_test.go +++ b/run_test.go @@ -9,9 +9,12 @@ import ( func TestCompleter_Complete(t *testing.T) { t.Parallel() + // Set debug environment variable so logs will be printed if testing.Verbose() { os.Setenv(envDebug, "1") } + + // Change to tests directory for testing completion of files and directories err := os.Chdir("./tests") if err != nil { t.Fatal(err) @@ -20,20 +23,20 @@ func TestCompleter_Complete(t *testing.T) { c := Command{ Sub: map[string]Command{ "sub1": { - Flags: map[string]*Predicate{ + Flags: map[string]Predicate{ "-flag1": PredictAnything, "-flag2": PredictNothing, }, }, "sub2": { - Flags: map[string]*Predicate{ + Flags: map[string]Predicate{ "-flag2": PredictNothing, "-flag3": PredictSet("opt1", "opt2", "opt12"), }, - Args: PredictDirs.Or(PredictFiles("*.md")), + Args: Predicate(PredictDirs).Or(PredictFiles("*.md")), }, }, - Flags: map[string]*Predicate{ + Flags: map[string]Predicate{ "-h": PredictNothing, "-global1": PredictAnything, "-o": PredictFiles("*.txt"), |
