aboutsummaryrefslogtreecommitdiffstats
path: root/t/chainlint/function.test
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-09-19 14:35:24 -0700
committerJunio C Hamano <gitster@pobox.com>2022-09-19 14:35:24 -0700
commit9d58241ee4e2c603404e028204221e508bb73644 (patch)
tree951433a317c33cfaa2a94d10d2761d82c345e929 /t/chainlint/function.test
parentMerge branch 'jk/list-objects-filter-cleanup' (diff)
parentchainlint: colorize problem annotations and test delimiters (diff)
downloadgit-9d58241ee4e2c603404e028204221e508bb73644.tar.gz
git-9d58241ee4e2c603404e028204221e508bb73644.zip
Merge branch 'es/chainlint'
Revamp chainlint script for our tests. * es/chainlint: chainlint: colorize problem annotations and test delimiters t: retire unused chainlint.sed t/Makefile: teach `make test` and `make prove` to run chainlint.pl test-lib: replace chainlint.sed with chainlint.pl test-lib: retire "lint harder" optimization hack t/chainlint: add more chainlint.pl self-tests chainlint.pl: allow `|| echo` to signal failure upstream of a pipe chainlint.pl: complain about loops lacking explicit failure handling chainlint.pl: don't flag broken &&-chain if failure indicated explicitly chainlint.pl: don't flag broken &&-chain if `$?` handled explicitly chainlint.pl: don't require `&` background command to end with `&&` t/Makefile: apply chainlint.pl to existing self-tests chainlint.pl: don't require `return|exit|continue` to end with `&&` chainlint.pl: validate test scripts in parallel chainlint.pl: add parser to identify test definitions chainlint.pl: add parser to validate tests chainlint.pl: add POSIX shell parser chainlint.pl: add POSIX shell lexical analyzer t: add skeleton chainlint.pl
Diffstat (limited to 't/chainlint/function.test')
-rw-r--r--t/chainlint/function.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/chainlint/function.test b/t/chainlint/function.test
new file mode 100644
index 0000000000..5ee59562c9
--- /dev/null
+++ b/t/chainlint/function.test
@@ -0,0 +1,13 @@
+# LINT: "()" in function definition not mistaken for subshell
+sha1_file() {
+ echo "$*" | sed "s#..#.git/objects/&/#"
+} &&
+
+# LINT: broken &&-chain in function and after function
+remove_object() {
+ file=$(sha1_file "$*") &&
+ test -e "$file"
+ rm -f "$file"
+}
+
+sha1_file arg && remove_object arg