MCPcopy
hub / github.com/helm/helm / TestAtomicWriteFile_EmptyContent

Function TestAtomicWriteFile_EmptyContent

internal/fileutil/fileutil_test.go:76–96  ·  view source on GitHub ↗

TestAtomicWriteFile_EmptyContent tests with empty content

(t *testing.T)

Source from the content-addressed store, hash-verified

74
75// TestAtomicWriteFile_EmptyContent tests with empty content
76func TestAtomicWriteFile_EmptyContent(t *testing.T) {
77 dir := t.TempDir()
78 testpath := filepath.Join(dir, "empty_helm")
79
80 reader := bytes.NewReader([]byte(""))
81 mode := os.FileMode(0644)
82
83 err := AtomicWriteFile(testpath, reader, mode)
84 if err != nil {
85 t.Errorf("AtomicWriteFile error with empty content: %s", err)
86 }
87
88 got, err := os.ReadFile(testpath)
89 if err != nil {
90 t.Fatal(err)
91 }
92
93 if len(got) != 0 {
94 t.Fatalf("expected empty content, got: %s", string(got))
95 }
96}
97
98// TestAtomicWriteFile_LargeContent tests with large content
99func TestAtomicWriteFile_LargeContent(t *testing.T) {

Callers

nothing calls this directly

Calls 3

AtomicWriteFileFunction · 0.85
FatalMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…