MCPcopy Index your code
hub / github.com/docker/cli / TestContainerListBuildContainerListOptions

Function TestContainerListBuildContainerListOptions

cli/command/container/list_test.go:19–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestContainerListBuildContainerListOptions(t *testing.T) {
20 filters := opts.NewFilterOpt()
21 assert.NilError(t, filters.Set("foo=bar"))
22 assert.NilError(t, filters.Set("baz=foo"))
23
24 contexts := []struct {
25 psOpts *psOptions
26 expectedAll bool
27 expectedSize bool
28 expectedLimit int
29 expectedFilters client.Filters
30 }{
31 {
32 psOpts: &psOptions{
33 all: true,
34 size: true,
35 last: 5,
36 filter: filters,
37 },
38 expectedAll: true,
39 expectedSize: true,
40 expectedLimit: 5,
41 expectedFilters: make(client.Filters).Add("foo", "bar").Add("baz", "foo"),
42 },
43 {
44 psOpts: &psOptions{
45 all: true,
46 size: true,
47 last: -1,
48 nLatest: true,
49 },
50 expectedAll: true,
51 expectedSize: true,
52 expectedLimit: 1,
53 },
54 {
55 psOpts: &psOptions{
56 all: true,
57 size: false,
58 last: 5,
59 filter: filters,
60 // With .Size, size should be true
61 format: "{{.Size}}",
62 },
63 expectedAll: true,
64 expectedSize: true,
65 expectedLimit: 5,
66 expectedFilters: make(client.Filters).Add("foo", "bar").Add("baz", "foo"),
67 },
68 {
69 psOpts: &psOptions{
70 all: true,
71 size: false,
72 last: 5,
73 filter: filters,
74 // With .Size, size should be true
75 format: "{{.Size}} {{.CreatedAt}} {{upper .Networks}}",
76 },

Callers

nothing calls this directly

Calls 2

SetMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…