MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestExtractAnnotations

Function TestExtractAnnotations

app/cli/cmd/attestation_test.go:80–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestExtractAnnotations(t *testing.T) {
81 testCases := []struct {
82 input []string
83 want map[string]string
84 wantErr bool
85 }{
86 {
87 input: []string{
88 "foo=bar",
89 "baz=qux",
90 },
91 want: map[string]string{
92 "foo": "bar",
93 "baz": "qux",
94 },
95 wantErr: false,
96 },
97 {
98 input: []string{
99 "foo=bar",
100 "baz",
101 },
102 wantErr: true,
103 },
104 {
105 input: []string{
106 "foo=bar",
107 "baz=qux",
108 "foo=bar",
109 },
110 want: map[string]string{
111 "foo": "bar",
112 "baz": "qux",
113 },
114 wantErr: false,
115 },
116 {
117 input: []string{
118 "foo=bar",
119 "baz=qux=qux",
120 },
121 want: map[string]string{
122 "foo": "bar",
123 "baz": "qux=qux",
124 },
125 wantErr: false,
126 },
127 {
128 input: []string{
129 "url=https://example.com/path?id=123&foo=bar",
130 },
131 want: map[string]string{
132 "url": "https://example.com/path?id=123&foo=bar",
133 },
134 wantErr: false,
135 },
136 }
137

Callers

nothing calls this directly

Calls 2

extractAnnotationsFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected