mirror of
https://github.com/git/git.git
synced 2024-12-02 22:43:44 +08:00
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>
This commit is contained in:
parent
a1d4f67c12
commit
32696a4cbe
31
t/t9850-shell.sh
Executable file
31
t/t9850-shell.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user