MCPcopy Create free account
hub / github.com/docker/cli / TestVendorAndVersion

Function TestVendorAndVersion

cli/cobra_test.go:13–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestVendorAndVersion(t *testing.T) {
14 // Non plugin.
15 assert.Equal(t, vendorAndVersion(&cobra.Command{Use: "test"}), "")
16
17 // Plugins with various lengths of vendor.
18 for _, tc := range []struct {
19 vendor string
20 version string
21 expected string
22 }{
23 {vendor: "vendor", expected: "(vendor)"},
24 {vendor: "vendor", version: "testing", expected: "(vendor, testing)"},
25 } {
26 t.Run(tc.vendor, func(t *testing.T) {
27 cmd := &cobra.Command{
28 Use: "test",
29 Annotations: map[string]string{
30 metadata.CommandAnnotationPlugin: "true",
31 metadata.CommandAnnotationPluginVendor: tc.vendor,
32 metadata.CommandAnnotationPluginVersion: tc.version,
33 },
34 }
35 assert.Equal(t, vendorAndVersion(cmd), tc.expected)
36 })
37 }
38}
39
40func TestInvalidPlugin(t *testing.T) {
41 root := &cobra.Command{Use: "root"}

Callers

nothing calls this directly

Calls 1

vendorAndVersionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…