Skip to content

Commit c480921

Browse files
committed
t9902: make test "set -e" clean
In order to catch mistakes like misspelling "test_expect_success", we would like to eventually be able to run our test suite with the "-e" option on. This script uses the "read" utility to populate a single variable with the contents of a here-document. As "read" signals that it saw the EOF by exiting with status 1, this triggers "set -e". Here, we squelch it with the standard "|| :" trick. A simpler alternative may be to use a simpler assignment, e.g., refs='main maint next seen' Either way would work, but just honor the original author's preference. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9f65947 commit c480921

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

t/t9902-completion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ test_expect_success '__gitcomp - doesnt fail because of invalid variable name' '
590590
__gitcomp "$invalid_variable_name"
591591
'
592592

593-
read -r -d "" refs <<-\EOF
593+
read -r -d "" refs <<-\EOF || :
594594
main
595595
maint
596596
next

0 commit comments

Comments
 (0)