MCPcopy Create free account
hub / github.com/cli/cli / writeFiles

Function writeFiles

internal/attachments/attach_test.go:20–28  ·  view source on GitHub ↗

writeFiles puts real files in a temporary working directory, because uploading opens the path it is given. A name may include directories, which are created.

(t *testing.T, names ...string)

Source from the content-addressed store, hash-verified

18// uploading opens the path it is given. A name may include directories, which
19// are created.
20func writeFiles(t *testing.T, names ...string) {
21 t.Helper()
22
23 t.Chdir(t.TempDir())
24 for _, name := range names {
25 require.NoError(t, os.MkdirAll(filepath.Dir(name), 0o755))
26 require.NoError(t, os.WriteFile(name, []byte("the bytes"), 0o600))
27 }
28}
29
30func testUploader(reg *httpmock.Registry) *Uploader {
31 return &Uploader{

Calls 3

MkdirAllMethod · 0.80
WriteFileMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected