MCPcopy Create free account
hub / github.com/driangle/taskmd / TestWriteJSONFile_MarshalError

Function TestWriteJSONFile_MarshalError

apps/cli/internal/web/export_test.go:619–630  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

617}
618
619func TestWriteJSONFile_MarshalError(t *testing.T) {
620 dir := t.TempDir()
621
622 // Channels cannot be marshaled to JSON
623 err := writeJSONFile(dir, "bad.json", make(chan int))
624 if err == nil {
625 t.Fatal("expected error when marshaling unmarshalable value")
626 }
627 if !strings.Contains(err.Error(), "failed to marshal") {
628 t.Errorf("expected 'failed to marshal' error, got: %v", err)
629 }
630}
631
632func TestWriteJSONFile_InvalidDir(t *testing.T) {
633 // Create a file where a directory is expected

Callers

nothing calls this directly

Calls 2

writeJSONFileFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected