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

Function writeFile

internal/attachments/userasset_test.go:17–24  ·  view source on GitHub ↗

writeFile creates a file of the given size relative to the test's working directory. Truncate makes a sparse file, so a size over the image limit costs nothing to create.

(t *testing.T, name string, size int64)

Source from the content-addressed store, hash-verified

15// directory. Truncate makes a sparse file, so a size over the image limit costs
16// nothing to create.
17func writeFile(t *testing.T, name string, size int64) {
18 t.Helper()
19
20 f, err := os.Create(name)
21 require.NoError(t, err)
22 defer f.Close()
23 require.NoError(t, f.Truncate(size))
24}
25
26func TestNewAsset(t *testing.T) {
27 tests := []struct {

Callers 1

TestNewAssetFunction · 0.70

Calls 3

HelperMethod · 0.65
CreateMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected