MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / TestSave

Function TestSave

internal/util/util_test.go:832–849  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

830}
831
832func TestSave(t *testing.T) {
833 tmpDir := t.TempDir()
834 path := filepath.Join(tmpDir, "testfile.txt")
835 data := []byte("testing normal save")
836
837 err := Save(path, data)
838 if err != nil {
839 t.Fatalf("Save failed: %v", err)
840 }
841
842 contents, err := os.ReadFile(path)
843 if err != nil {
844 t.Fatalf("unable to read saved file: %v", err)
845 }
846 if !bytes.Equal(contents, data) {
847 t.Errorf("saved file mismatch: got %q, want %q", contents, data)
848 }
849}
850
851// TestFilePath just ensures the slash normalization works as expected.
852func TestFilePath(t *testing.T) {

Callers

nothing calls this directly

Calls 2

SaveFunction · 0.70
ReadFileMethod · 0.45

Tested by

no test coverage detected