Skip to content

Commit

Permalink
Merge pull request #157 from commander-cli/enforece-interfaces-at-com…
Browse files Browse the repository at this point in the history
…pile-time

Check interface implementation at compile time
  • Loading branch information
SimonBaeumer authored Dec 2, 2020
2 parents c9f9703 + 6b26c5e commit 93ed14f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/matcher/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ const (
File = "file"
)

var (
_ Matcher = (*TextMatcher)(nil)
_ Matcher = (*ContainsMatcher)(nil)
_ Matcher = (*EqualMatcher)(nil)
_ Matcher = (*NotContainsMatcher)(nil)
_ Matcher = (*JSONMatcher)(nil)
_ Matcher = (*XMLMatcher)(nil)
_ Matcher = (*FileMatcher)(nil)
)

// The function used to open files when necessary for matching
// Allows the file IO to be overridden during tests
var ReadFile = ioutil.ReadFile
Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/docker_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"time"
)

var _ Executor = (*DockerExecutor)(nil)

// DockerExecutor executes the test inside a docker container
type DockerExecutor struct {
Image string // Image which is started to execute the test
Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/local_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/commander-cli/cmd"
)

var _ Executor = (*LocalExecutor)(nil)

// LocalExecutor will be used to execute tests on the local host
type LocalExecutor struct {
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/runtime/ssh_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"strings"
)

var _ Executor = (*SSHExecutor)(nil)

// SSHExecutor
type SSHExecutor struct {
Host string
Expand Down

0 comments on commit 93ed14f

Please sign in to comment.