diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/fixtures/shell-test.c | 16 | ||||
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 36 |
2 files changed, 51 insertions, 1 deletions
diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c index d9ec254aff..3f3976ece5 100644 --- a/test/functional/fixtures/shell-test.c +++ b/test/functional/fixtures/shell-test.c @@ -12,8 +12,12 @@ static void help(void) puts(" shell-test"); puts(" shell-test EXE"); puts(" Prints \"ready $ \" to stderr."); + puts(" shell-test -t {prompt text}"); + puts(" Prints \"{prompt text} $ \" to stderr."); puts(" shell-test EXE \"prog args...\""); puts(" Prints \"ready $ prog args...\\n\" to stderr."); + puts(" shell-test -t {prompt text} EXE \"prog args...\""); + puts(" Prints \"{prompt text} $ progs args...\" to stderr."); puts(" shell-test REP {byte} \"line line line\""); puts(" Prints \"{lnr}: line line line\\n\" to stdout {byte} times."); puts(" I.e. for `shell-test REP ab \"test\"'"); @@ -30,7 +34,17 @@ int main(int argc, char **argv) } if (argc >= 2) { - if (strcmp(argv[1], "EXE") == 0) { + if (strcmp(argv[1], "-t") == 0) { + if (argc < 3) { + fprintf(stderr,"Missing prompt text for -t option\n"); + return 5; + } else { + fprintf(stderr, "%s $ ", argv[2]); + if (argc >= 5 && (strcmp(argv[3], "EXE") == 0)) { + fprintf(stderr, "%s\n", argv[4]); + } + } + } else if (strcmp(argv[1], "EXE") == 0) { fprintf(stderr, "ready $ "); if (argc >= 3) { fprintf(stderr, "%s\n", argv[2]); diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 7a9d2a9b36..9bb683f25f 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -79,6 +79,30 @@ describe(':terminal (with fake shell)', function() ]]) end) + it("with no argument, and 'shell' is set to empty string", function() + nvim('set_option', 'shell', '') + terminal_with_fake_shell() + wait() + screen:expect([[ + ^ | + ~ | + ~ | + E91: 'shell' option is empty | + ]]) + end) + + it("with no argument, but 'shell' has arguments, acts like termopen()", function() + nvim('set_option', 'shell', nvim_dir..'/shell-test -t jeff') + terminal_with_fake_shell() + wait() + screen:expect([[ + jeff $ | + [Process exited 0] | + | + -- TERMINAL -- | + ]]) + end) + it('executes a given command through the shell', function() terminal_with_fake_shell('echo hi') wait() @@ -90,6 +114,18 @@ describe(':terminal (with fake shell)', function() ]]) end) + it("executes a given command through the shell, when 'shell' has arguments", function() + nvim('set_option', 'shell', nvim_dir..'/shell-test -t jeff') + terminal_with_fake_shell('echo hi') + wait() + screen:expect([[ + jeff $ echo hi | + | + [Process exited 0] | + -- TERMINAL -- | + ]]) + end) + it('allows quotes and slashes', function() terminal_with_fake_shell([[echo 'hello' \ "world"]]) wait() |