fix: address the release-prep review of #677

test: record sendInput('-x hello') and sendInput('-\r') and check the shell argv ends -l -- <text> on both send-keys -l branches

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-24 14:37:05 +02:00
1 parent 0eb9255465
commit d920375e5e
1 file changed
+17
+17
View File
@@ -293,4 +293,21 @@ describe('sendInput line breaks', () => {
expect(typed.ran).toHaveLength(1);
expect(typed.ran[0]).toMatch(/ send-keys -t "codeman-abc12345" -l -- 'just type'$/);
});
// The argv a shell hands tmux must put `--` right before the text, or tmux reads
// a leading `-` as its own option and types nothing.
it('types text that starts with a hyphen after --, on both send-keys -l branches', async () => {
const keysArgv = (cmd: string) => argvOf(cmd.replace(/^.*? send-keys /, `${FAKE_TMUX} send-keys `));
const typed = managerWithSession();
await typed.sendInput('s1', '-x hello');
expect(typed.ran).toHaveLength(1);
expect(keysArgv(typed.ran[0]).slice(-3)).toEqual(['-l', '--', '-x hello']);
const answer = managerWithSession();
await answer.sendInput('s1', '-\r');
expect(answer.ran).toHaveLength(2);
expect(keysArgv(answer.ran[0]).slice(-3)).toEqual(['-l', '--', '-']);
expect(answer.ran[1]).toMatch(/ send-keys -t "codeman-abc12345" Enter$/);
});
});