-
Notifications
You must be signed in to change notification settings - Fork 180
/
command.go
54 lines (47 loc) · 1.12 KB
/
command.go
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
46
47
48
49
50
51
52
53
54
package fakes
import "github.com/cloudfoundry/bosh-bootloader/storage"
type Command struct {
CheckFastFailsCall struct {
CallCount int
Receives struct {
State storage.State
SubcommandFlags []string
}
Returns struct {
Error error
}
}
ExecuteCall struct {
CallCount int
PassState bool
Receives struct {
State storage.State
SubcommandFlags []string
}
Returns struct {
Error error
}
}
UsageCall struct {
CallCount int
Returns struct {
Usage string
}
}
}
func (c *Command) CheckFastFails(subcommandFlags []string, state storage.State) error {
c.CheckFastFailsCall.CallCount++
c.CheckFastFailsCall.Receives.State = state
c.CheckFastFailsCall.Receives.SubcommandFlags = subcommandFlags
return c.CheckFastFailsCall.Returns.Error
}
func (c *Command) Execute(subcommandFlags []string, state storage.State) error {
c.ExecuteCall.CallCount++
c.ExecuteCall.Receives.State = state
c.ExecuteCall.Receives.SubcommandFlags = subcommandFlags
return c.ExecuteCall.Returns.Error
}
func (c *Command) Usage() string {
c.UsageCall.CallCount++
return c.UsageCall.Returns.Usage
}