Merge branch 'ma/t0091-fixup' into next
"git bugreport" tests did not test what it wanted to test, which has been corrected. * ma/t0091-fixup: t0091-bugreport.sh: actually verify some content of report
This commit is contained in:
@ -5,29 +5,50 @@ test_description='git bugreport'
|
|||||||
TEST_PASSES_SANITIZE_LEAK=true
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# Headers "[System Info]" will be followed by a non-empty line if we put some
|
test_expect_success 'create a report' '
|
||||||
# information there; we can make sure all our headers were followed by some
|
git bugreport -s format &&
|
||||||
# information to check if the command was successful.
|
test_file_not_empty git-bugreport-format.txt
|
||||||
HEADER_PATTERN="^\[.*\]$"
|
'
|
||||||
|
|
||||||
check_all_headers_populated () {
|
test_expect_success 'report contains wanted template (before first section)' '
|
||||||
while read -r line
|
sed -ne "/^\[/q;p" git-bugreport-format.txt >actual &&
|
||||||
do
|
cat >expect <<-\EOF &&
|
||||||
if test "$(grep "$HEADER_PATTERN" "$line")"
|
Thank you for filling out a Git bug report!
|
||||||
then
|
Please answer the following questions to help us understand your issue.
|
||||||
echo "$line"
|
|
||||||
read -r nextline
|
|
||||||
if test -z "$nextline"; then
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
test_expect_success 'creates a report with content in the right places' '
|
What did you do before the bug happened? (Steps to reproduce your issue)
|
||||||
test_when_finished rm git-bugreport-check-headers.txt &&
|
|
||||||
git bugreport -s check-headers &&
|
What did you expect to happen? (Expected behavior)
|
||||||
check_all_headers_populated <git-bugreport-check-headers.txt
|
|
||||||
|
What happened instead? (Actual behavior)
|
||||||
|
|
||||||
|
What'\''s different between what you expected and what actually happened?
|
||||||
|
|
||||||
|
Anything else you want to add:
|
||||||
|
|
||||||
|
Please review the rest of the bug report below.
|
||||||
|
You can delete any lines you don'\''t wish to share.
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'sanity check "System Info" section' '
|
||||||
|
test_when_finished rm -f git-bugreport-format.txt &&
|
||||||
|
|
||||||
|
sed -ne "/^\[System Info\]$/,/^$/p" <git-bugreport-format.txt >system &&
|
||||||
|
|
||||||
|
# The beginning should match "git version --build-info" verbatim,
|
||||||
|
# but rather than checking bit-for-bit equality, just test some basics.
|
||||||
|
grep "git version [0-9]." system &&
|
||||||
|
grep "shell-path: ." system &&
|
||||||
|
|
||||||
|
# After the version, there should be some more info.
|
||||||
|
# This is bound to differ from environment to environment,
|
||||||
|
# so we just do some rather high-level checks.
|
||||||
|
grep "uname: ." system &&
|
||||||
|
grep "compiler info: ." system
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'dies if file with same name as report already exists' '
|
test_expect_success 'dies if file with same name as report already exists' '
|
||||||
|
Reference in New Issue
Block a user