зеркало из https://github.com/microsoft/docker.git
Merge pull request #15371 from ankushagarwal/flags
Add test to check if subcommands are sorted
This commit is contained in:
Коммит
38e5764132
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/client"
|
||||
|
@ -36,9 +35,6 @@ func main() {
|
|||
|
||||
help := "\nCommands:\n"
|
||||
|
||||
// TODO(tiborvass): no need to sort if we ensure dockerCommands is sorted
|
||||
sort.Sort(byName(dockerCommands))
|
||||
|
||||
for _, cmd := range dockerCommands {
|
||||
help += fmt.Sprintf(" %-10.10s%s\n", cmd.name, cmd.description)
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ var dockerCommands = []command{
|
|||
{"login", "Register or log in to a Docker registry"},
|
||||
{"logout", "Log out from a Docker registry"},
|
||||
{"logs", "Fetch the logs of a container"},
|
||||
{"port", "List port mappings or a specific mapping for the CONTAINER"},
|
||||
{"pause", "Pause all processes within a container"},
|
||||
{"port", "List port mappings or a specific mapping for the CONTAINER"},
|
||||
{"ps", "List containers"},
|
||||
{"pull", "Pull an image or a repository from a registry"},
|
||||
{"push", "Push an image or a repository to a registry"},
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Tests if the subcommands of docker are sorted
|
||||
func TestDockerSubcommandsAreSorted(t *testing.T) {
|
||||
if !sort.IsSorted(byName(dockerCommands)) {
|
||||
t.Fatal("Docker subcommands are not in sorted order")
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче