-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompatibility_test.go
More file actions
45 lines (34 loc) · 859 Bytes
/
compatibility_test.go
File metadata and controls
45 lines (34 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package matr
import (
"context"
"testing"
cliruntime "github.com/euforic/matr/cli"
)
func TestRootAPIRemainsCompatibleWithCLIPackage(t *testing.T) {
t.Parallel()
acceptRuntime(New())
acceptTask(&Task{})
acceptInvocation(&Invocation{})
acceptFlagType(FlagBool)
acceptHandler(nil)
called := false
m := New()
m.Handle(&Task{
Name: "default",
Handler: func(ctx context.Context, cmd *Invocation, args []string) error {
called = true
return nil
},
})
if err := m.Run(context.Background()); err != nil {
t.Fatalf("Run returned error: %v", err)
}
if !called {
t.Fatal("expected default handler to run")
}
}
func acceptRuntime(*cliruntime.Matr) {}
func acceptTask(*cliruntime.Task) {}
func acceptInvocation(*cliruntime.Invocation) {}
func acceptFlagType(cliruntime.FlagType) {}
func acceptHandler(cliruntime.HandlerFunc) {}