diff options
author | Jeff King <peff@peff.net> | 2022-09-29 01:50:36 +0300 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-10-01 07:23:38 +0300 |
commit | 32696a4cbe90929ae79ea442f5102c513ce3dfaa (patch) | |
tree | 6586dd4d05403f4c218df4ff3796b23c376b7321 | |
parent | a1d4f67c12ac172f835e6d5e4e0a197075e2146b (diff) |
shell: add basic tests
We have no tests of even basic functionality of git-shell. Let's add a
couple of obvious ones. This will serve as a framework for adding tests
for new things we fix, as well as making sure we don't screw anything up
too badly while doing so.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
-rwxr-xr-x | t/t9850-shell.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t9850-shell.sh b/t/t9850-shell.sh new file mode 100755 index 0000000000..2af476c3af --- /dev/null +++ b/t/t9850-shell.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +test_description='git shell tests' +. ./test-lib.sh + +test_expect_success 'shell allows upload-pack' ' + printf 0000 >input && + git upload-pack . <input >expect && + git shell -c "git-upload-pack $SQ.$SQ" <input >actual && + test_cmp expect actual +' + +test_expect_success 'shell forbids other commands' ' + test_must_fail git shell -c "git config foo.bar baz" +' + +test_expect_success 'shell forbids interactive use by default' ' + test_must_fail git shell +' + +test_expect_success 'shell allows interactive command' ' + mkdir git-shell-commands && + write_script git-shell-commands/ping <<-\EOF && + echo pong + EOF + echo pong >expect && + echo ping | git shell >actual && + test_cmp expect actual +' + +test_done |