MCPcopy Index your code
hub / github.com/perkeep/perkeep / TestStringFromMixedArray

Function TestStringFromMixedArray

pkg/schema/schema_test.go:144–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestStringFromMixedArray(t *testing.T) {
145 tests := []mixPartsTest{
146 {`["brad"]`, "brad"},
147 {`["brad", 32, 70]`, "brad F"},
148 {`["brad", "fitz"]`, "bradfitz"},
149 {`["Am", 233, "lie.jpg"]`, "Am\xe9lie.jpg"},
150 }
151 for idx, test := range tests {
152 var v []interface{}
153 if err := json.Unmarshal([]byte(test.json), &v); err != nil {
154 t.Fatalf("invalid JSON in test %d", idx)
155 }
156 got := stringFromMixedArray(v)
157 if got != test.expected {
158 t.Errorf("test %d got %q; expected %q", idx, got, test.expected)
159 }
160 }
161}
162
163func TestParseInLocation_UnknownLocation(t *testing.T) {
164 // Example of parsing a time from an API (e.g. Flickr) that

Callers

nothing calls this directly

Calls 2

stringFromMixedArrayFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected