mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
A bunch of tests rely on Perl to print data in various different ways.
These usages fall into the following categories:
- Print data conditionally by matching patterns. These usecases can be
converted to use awk(1) rather easily.
- Print data repeatedly. These usecases can typically be converted to
use a combination of `test-tool genzeros` and sed(1).
- Print data in reverse. These usecases can be converted to use
awk(1) or `sort -r`.
Refactor the tests accordingly so that we can drop a couple of
PERL_TEST_HELPERS prerequisites.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
39 lines
864 B
Bash
Executable File
39 lines
864 B
Bash
Executable File
#!/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_expect_success 'shell complains of overlong commands' '
|
|
test-tool genzeros | tr "\000" "a" |
|
|
test_must_fail git shell 2>err &&
|
|
grep "too long" err
|
|
'
|
|
|
|
test_done
|