(t *testing.T)
| 25 | } |
| 26 | |
| 27 | func TestHookMutatesCommitMsg(t *testing.T) { |
| 28 | tempDir := initGitForCommitMsg(t) |
| 29 | tempDir.MkdirAll(".quickhook", "commit-msg") |
| 30 | tempDir.WriteFile( |
| 31 | []string{".quickhook", "commit-msg", "appends"}, |
| 32 | // -n makes echo not emit a trailing newline. |
| 33 | "#!/bin/bash \n echo -n \" second\" >> $1") |
| 34 | |
| 35 | editMsgFile := writeCommitEditMsg(t, "First") |
| 36 | _, err := tempDir.ExecQuickhook("hook", "commit-msg", editMsgFile) |
| 37 | assert.NoError(t, err) |
| 38 | |
| 39 | newEditMsg, err := os.ReadFile(editMsgFile) |
| 40 | assert.NoError(t, err) |
| 41 | assert.Equal(t, "First second", string(newEditMsg)) |
| 42 | } |
| 43 | |
| 44 | func TestFailingHook(t *testing.T) { |
| 45 | tempDir := initGitForCommitMsg(t) |
nothing calls this directly
no test coverage detected