From: Junio C Hamano Date: Mon, 20 Aug 2018 18:33:55 +0000 (-0700) Subject: Merge branch 'wc/make-funnynames-shared-lazy-prereq' X-Git-Tag: v2.19.0-rc0~11 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e72db08f151dfec0c177b91ae903a8fbe56cda7c?hp=-c Merge branch 'wc/make-funnynames-shared-lazy-prereq' A test prerequisite defined by various test scripts with slightly different semantics has been consolidated into a single copy and made into a lazily defined one. * wc/make-funnynames-shared-lazy-prereq: t: factor out FUNNYNAMES as shared lazy prereq --- e72db08f151dfec0c177b91ae903a8fbe56cda7c diff --combined t/t9902-completion.sh index 5ff43b9cbb,532df85c43..175f83d704 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@@ -501,42 -501,6 +501,42 @@@ test_expect_success '__gitcomp - suffix EOF ' +test_expect_success '__gitcomp - ignore optional negative options' ' + test_gitcomp "--" "--abc --def --no-one -- --no-two" <<-\EOF + --abc Z + --def Z + --no-one Z + --no-... Z + EOF +' + +test_expect_success '__gitcomp - ignore/narrow optional negative options' ' + test_gitcomp "--a" "--abc --abcdef --no-one -- --no-two" <<-\EOF + --abc Z + --abcdef Z + EOF +' + +test_expect_success '__gitcomp - ignore/narrow optional negative options' ' + test_gitcomp "--n" "--abc --def --no-one -- --no-two" <<-\EOF + --no-one Z + --no-... Z + EOF +' + +test_expect_success '__gitcomp - expand all negative options' ' + test_gitcomp "--no-" "--abc --def --no-one -- --no-two" <<-\EOF + --no-one Z + --no-two Z + EOF +' + +test_expect_success '__gitcomp - expand/narrow all negative options' ' + test_gitcomp "--no-o" "--abc --def --no-one -- --no-two" <<-\EOF + --no-one Z + EOF +' + test_expect_success '__gitcomp - doesnt fail because of invalid variable name' ' __gitcomp "$invalid_variable_name" ' @@@ -1103,7 -1067,7 +1103,7 @@@ test_expect_success '__git_complete_ref master-in-other Z EOF ( - cur= + cur= && __git_complete_refs --remote=other && print_comp ) && @@@ -1122,7 -1086,7 +1122,7 @@@ test_expect_success '__git_complete_ref master-in-other Z EOF ( - cur= + cur= && __git_complete_refs --track && print_comp ) && @@@ -1278,7 -1242,7 +1278,7 @@@ test_expect_success 'setup for path com touch BS\\dir/DQ\"file \ '$'separators\034in\035dir/sep\036in\037file'' then - test_set_prereq FUNNYNAMES + test_set_prereq FUNNIERNAMES else rm -rf BS\\dir '$'separators\034in\035dir'' fi @@@ -1320,7 -1284,7 +1320,7 @@@ test_expect_success '__git_complete_ind test_path_completion árvíztűrő/С "árvíztűrő/Сайн яваарай" ' - test_expect_success FUNNYNAMES \ + test_expect_success FUNNIERNAMES \ '__git_complete_index_file - C-style escapes in ls-files output' ' test_path_completion BS \ BS\\dir && @@@ -1332,7 -1296,7 +1332,7 @@@ BS\\dir/DQ\"file ' - test_expect_success FUNNYNAMES \ + test_expect_success FUNNIERNAMES \ '__git_complete_index_file - \nnn-escaped characters in ls-files output' ' test_path_completion sep '$'separators\034in\035dir'' && test_path_completion '$'separators\034i'' \ @@@ -1434,8 -1398,8 +1434,8 @@@ test_expect_success 'double dash "git c --ignore-other-worktrees Z --recurse-submodules Z --progress Z - --no-track Z - --no-recurse-submodules Z + --no-quiet Z + --no-... Z EOF ' @@@ -1643,7 -1607,6 +1643,7 @@@ test_expect_success 'completion used /dev/null - then - test_set_prereq FUNNYNAMES - else + if test_have_prereq !FUNNYNAMES; then say 'Your filesystem does not allow newlines in filenames.' fi test_expect_success FUNNYNAMES 'prompt - with newline in path' ' + repo_with_newline="repo + with + newline" && + mkdir "$repo_with_newline" && printf " (master)" >expected && git init "$repo_with_newline" && test_when_finished "rm -rf \"$repo_with_newline\"" && @@@ -529,7 -526,7 +526,7 @@@ test_expect_success 'prompt - bash colo printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear}):AFTER\\nmaster" >expected && ( GIT_PS1_SHOWCOLORHINTS=y && - __git_ps1 "BEFORE:" ":AFTER" >"$actual" + __git_ps1 "BEFORE:" ":AFTER" >"$actual" && printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual" ) && test_cmp expected "$actual" diff --combined t/test-lib.sh index 78f7097746,f221aa95e5..8bb0f4348e --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -675,8 -675,7 +675,8 @@@ test_run_ () trace= # 117 is magic because it is unlikely to match the exit # code of other programs - if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)" + if $(printf '%s\n' "$1" | sed -f "$GIT_BUILD_DIR/t/chainlint.sed" | grep -q '?![A-Z][A-Z]*?!') || + test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)" then error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1" fi @@@ -1104,6 -1103,20 +1104,20 @@@ test_lazy_prereq CASE_INSENSITIVE_FS test "$(cat CamelCase)" != good ' + test_lazy_prereq FUNNYNAMES ' + test_have_prereq !MINGW && + touch -- \ + "FUNNYNAMES tab embedded" \ + "FUNNYNAMES \"quote embedded\"" \ + "FUNNYNAMES newline + embedded" 2>/dev/null && + rm -- \ + "FUNNYNAMES tab embedded" \ + "FUNNYNAMES \"quote embedded\"" \ + "FUNNYNAMES newline + embedded" 2>/dev/null + ' + test_lazy_prereq UTF8_NFD_TO_NFC ' # check whether FS converts nfd unicode to nfc auml=$(printf "\303\244")