diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/cli-opts.sh | 14 | ||||
-rwxr-xr-x | tests/install-uninstall.sh | 4 | ||||
-rwxr-xr-x | tests/remotes.sh | 14 |
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh index 54b9aee..d5783e2 100755 --- a/tests/cli-opts.sh +++ b/tests/cli-opts.sh @@ -8,6 +8,7 @@ export PATH="$PWD/tests:$PATH" test_langs() { testing 'langs' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=POSIX sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -17,6 +18,7 @@ test_langs() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=C sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -26,6 +28,7 @@ test_langs() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=en_US.UTF-8 sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -35,6 +38,7 @@ test_langs() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=en_AU.UTF-8 sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -44,6 +48,7 @@ test_langs() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=pt_BR.UTF-8 sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -53,6 +58,7 @@ test_langs() { assert_fgrep_stdout 'Uso' assert_fgrep_stdout 'Opções' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=pt_PT.UTF-8 sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -68,6 +74,7 @@ test_langs() { test_help_flags() { testing 'help flags' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=en_US.UTF-8 sh src/git-permalink -h 1>"$OUT" 2>"$ERR" @@ -77,6 +84,7 @@ test_help_flags() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=en_US.UTF-8 sh src/git-permalink --help 1>"$OUT" 2>"$ERR" @@ -87,6 +95,7 @@ test_help_flags() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=en_US.UTF-8 sh src/git-permalink --something something -h 1>"$OUT" 2>"$ERR" @@ -96,6 +105,7 @@ test_help_flags() { assert_fgrep_stdout 'Usage' assert_fgrep_stdout 'Options' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" LANG=en_US.UTF-8 sh src/git-permalink --help more things 1>"$OUT" 2>"$ERR" @@ -113,6 +123,7 @@ test_version_flags() { testing 'version flags' REGEX='^git-permalink-[0-9\.]+ [0-9-]+$' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" sh src/git-permalink -V 1>"$OUT" 2>"$ERR" @@ -121,6 +132,7 @@ test_version_flags() { assert_empty_stderr assert_grep_stdout "$REGEX" + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" sh src/git-permalink --version 1>"$OUT" 2>"$ERR" @@ -129,6 +141,7 @@ test_version_flags() { assert_empty_stderr assert_grep_stdout "$REGEX" + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" sh src/git-permalink -V --abc xyz 1>"$OUT" 2>"$ERR" @@ -136,6 +149,7 @@ test_version_flags() { assert_status 0 assert_grep_stdout "$REGEX" + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" sh src/git-permalink --version things again 1>"$OUT" 2>"$ERR" diff --git a/tests/install-uninstall.sh b/tests/install-uninstall.sh index c0b402a..6bfdac0 100755 --- a/tests/install-uninstall.sh +++ b/tests/install-uninstall.sh @@ -9,6 +9,7 @@ PATH="$TEST_DESTDIR/usr/local/bin:$PATH" test_install_uninstall_targets() { testing 'install uninstall targets' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" make DESTDIR="$TEST_DESTDIR" install 1>"$OUT" 2>"$ERR" @@ -18,6 +19,7 @@ test_install_uninstall_targets() { assert_grep_stdout '^git-permalink-[0-9\.]+ [0-9-]+$' assert_empty_stderr + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" find "$TEST_DESTDIR" -type f | wc -l 1>"$OUT" 2>"$ERR" @@ -26,6 +28,7 @@ test_install_uninstall_targets() { assert_stdout '5' assert_empty_stderr + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" make DESTDIR="$TEST_DESTDIR" uninstall 1>"$OUT" 2>"$ERR" @@ -35,6 +38,7 @@ test_install_uninstall_targets() { assert_empty_stdout assert_fgrep_stderr 'not a git command' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" find "$TEST_DESTDIR" -type f | wc -l 1>"$OUT" 2>"$ERR" diff --git a/tests/remotes.sh b/tests/remotes.sh index 4d6a8a2..3ed842c 100755 --- a/tests/remotes.sh +++ b/tests/remotes.sh @@ -31,6 +31,7 @@ new_repo() { test_supported_remotes() { testing 'supported remotes' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo git://euandreh.xyz/remembering @@ -42,6 +43,7 @@ test_supported_remotes() { assert_fgrep_stderr 'xdg-open: https://git.euandreh.xyz' cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://git.sr.ht/~sircmpwn/ctools @@ -52,6 +54,7 @@ test_supported_remotes() { assert_empty_stderr cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://git.kernel.org/pub/scm/git/git.git @@ -63,6 +66,7 @@ test_supported_remotes() { assert_fgrep_stderr 'xdg-open: https://git.kernel.org' cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://git.savannah.gnu.org/guix.git @@ -73,6 +77,7 @@ test_supported_remotes() { assert_empty_stderr cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://notabug.org/cwebber/guile-gcrypt @@ -84,6 +89,7 @@ test_supported_remotes() { assert_fgrep_stderr 'xdg-open: https://notabug.org' cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://codeberg.org/dnkl/yambar @@ -94,6 +100,7 @@ test_supported_remotes() { assert_empty_stderr cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://bitbucket.org/uprojects/jsmn @@ -105,6 +112,7 @@ test_supported_remotes() { assert_fgrep_stderr 'xdg-open: https://bitbucket.org' cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://pagure.io/aquedoc @@ -115,6 +123,7 @@ test_supported_remotes() { assert_empty_stderr cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://gitlab.com/nonguix/nonguix @@ -126,6 +135,7 @@ test_supported_remotes() { assert_fgrep_stderr 'xdg-open: https://gitlab.com/nonguix/nonguix' cd - > /dev/null || exit 1 + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://github.com/skeeto/elfeed @@ -142,6 +152,7 @@ test_supported_remotes() { test_unsupported_remote() { testing 'unsupported remotes' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" new_repo https://example.com/a/b @@ -151,6 +162,7 @@ test_unsupported_remote() { assert_empty_stdout assert_fgrep_stderr 'Unsupported origin: https://example.com' + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" git config git-permalink.template-commit-file 'before %s middle %s after' @@ -160,6 +172,7 @@ test_unsupported_remote() { assert_grep_stdout 'before .+ middle README.md after' assert_empty_stderr + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" git config --unset git-permalink.template-commit-file @@ -170,6 +183,7 @@ test_unsupported_remote() { assert_grep_stdout 'before README.md middle .+ after' assert_empty_stderr + N="$LINENO" OUT="$(mktemp)" ERR="$(mktemp)" git config --unset git-permalink.template-file-commit |