MCPcopy Index your code
hub / github.com/coder/coder / Parse

Function Parse

aibridge/fixtures/fixtures.go:230–241  ·  view source on GitHub ↗

Parse parses raw txtar data into a [Fixture].

(t *testing.T, data []byte)

Source from the content-addressed store, hash-verified

228
229// Parse parses raw txtar data into a [Fixture].
230func Parse(t *testing.T, data []byte) Fixture {
231 t.Helper()
232
233 archive := txtar.Parse(data)
234 require.NotEmpty(t, archive.Files, "fixture archive has no files")
235
236 sections := make(map[string][]byte, len(archive.Files))
237 for _, f := range archive.Files {
238 sections[f.Name] = f.Data
239 }
240 return Fixture{sections: sections, t: t}
241}
242
243// Request extracts the "request" fixture from raw txtar data.
244func Request(t *testing.T, fixture []byte) []byte {

Calls 3

NotEmptyMethod · 0.80
HelperMethod · 0.65
ParseMethod · 0.65