| 830 | } |
| 831 | |
| 832 | func 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. |
| 852 | func TestFilePath(t *testing.T) { |