3 test_description='git bugreport'
7 # Headers "[System Info]" will be followed by a non-empty line if we put some
8 # information there; we can make sure all our headers were followed by some
9 # information to check if the command was successful.
10 HEADER_PATTERN="^\[.*\]$"
12 check_all_headers_populated () {
15 if test "$(grep "$HEADER_PATTERN" "$line")"
19 if test -z "$nextline"; then
26 test_expect_success 'creates a report with content in the right places' '
27 test_when_finished rm git-bugreport-check-headers.txt &&
28 git bugreport -s check-headers &&
29 check_all_headers_populated <git-bugreport-check-headers.txt
32 test_expect_success 'dies if file with same name as report already exists' '
33 test_when_finished rm git-bugreport-duplicate.txt &&
34 >>git-bugreport-duplicate.txt &&
35 test_must_fail git bugreport --suffix duplicate
38 test_expect_success '--output-directory puts the report in the provided dir' '
39 test_when_finished rm -fr foo/ &&
40 git bugreport -o foo/ &&
41 test_path_is_file foo/git-bugreport-*
44 test_expect_success 'incorrect arguments abort with usage' '
45 test_must_fail git bugreport --false 2>output &&
46 test_i18ngrep usage output &&
47 test_path_is_missing git-bugreport-*
50 test_expect_success 'runs outside of a git dir' '
51 test_when_finished rm non-repo/git-bugreport-* &&
55 test_expect_success 'can create leading directories outside of a git dir' '
56 test_when_finished rm -fr foo/bar/baz &&
57 nongit git bugreport -o foo/bar/baz