MCPcopy Create free account
hub / github.com/Facets-cloud/flow / writeFakeEditor

Function writeFakeEditor

internal/app/edit_test.go:15–28  ·  view source on GitHub ↗

writeFakeEditor writes an executable script into dir that appends the text "edited by test" to any file path passed as its first argument. Returns the script path. Skips the test on Windows.

(t *testing.T, dir string)

Source from the content-addressed store, hash-verified

13// text "edited by test" to any file path passed as its first argument.
14// Returns the script path. Skips the test on Windows.
15func writeFakeEditor(t *testing.T, dir string) string {
16 t.Helper()
17 if runtime.GOOS == "windows" {
18 t.Skip("fake editor relies on a POSIX shell script")
19 }
20 path := filepath.Join(dir, "fake-editor.sh")
21 content := `#!/bin/sh
22printf '\nedited by test\n' >> "$1"
23`
24 if err := os.WriteFile(path, []byte(content), 0o755); err != nil {
25 t.Fatalf("write fake editor: %v", err)
26 }
27 return path
28}
29
30func TestCmdEditTaskBumpsUpdatedAt(t *testing.T) {
31 root, db := showListEditDB(t)

Calls

no outgoing calls

Tested by

no test coverage detected