Torsten Bögershausen <tbo...@web.de> writes:

> The test suite needs to be run on different platforms.
> As it may be difficult for contributors to catch syntax
> which work on GNU/linux, but is unportable, make a quick check
> for the most common problems.
> "sed -i", "echo -n" or "array in shell scripts"
> This list is not complete, and may need to be extended
>
> Signed-off-by: Torsten Bögershausen <tbo...@web.de>
> ---
> We add 1 second test execution time
> Is this a useful idea at all?

Please do not name it after t/t[0-9]*.sh pattern, which are about
testing git.

This (once it gets cleaned up to reduce false positives) belongs to
"cd t && make test-lint".

>  
>  t/t99999-syntax-check.sh | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>  create mode 100755 t/t99999-syntax-check.sh
>
> diff --git a/t/t99999-syntax-check.sh b/t/t99999-syntax-check.sh
> new file mode 100755
> index 0000000..c4a9289
> --- /dev/null
> +++ b/t/t99999-syntax-check.sh
> @@ -0,0 +1,28 @@
> +#!/bin/sh
> +
> +test_description='Basic check if shell syntax is portable'
> +
> +. ./test-lib.sh
> +
> +
> +test_expect_success 'No arrays in shell scripts' '
> +     >expected &&
> +     (grep -i -n "^[  ]*declare[      ][      ]*" ../*.sh ../../git-* 
> >actual 2>&1 || : ) &&
> +     test_cmp expected actual &&
> +     rm expected actual
> +'
> +
> +test_expect_success 'No sed -i' '
> +     >expected &&
> +     (grep -n "^[     ]*sed[  ][      ]*\-i" ../*.sh ../../git-* >actual 
> 2>&1 || : ) &&
> +     test_cmp expected actual &&
> +     rm expected actual
> +'
> +
> +test_expect_success 'No echo -n' '
> +     >expected &&
> +     (grep -n "^[     ]*echo[         ][      ]*\-n" ../*.sh ../../git-* 
> >actual 2>&1 || : ) &&
> +     test_cmp expected actual &&
> +     rm expected actual
> +'
> +test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to