diff options
Diffstat (limited to 'tests/install-uninstall.sh')
-rwxr-xr-x | tests/install-uninstall.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/install-uninstall.sh b/tests/install-uninstall.sh new file mode 100755 index 0000000..f4340e2 --- /dev/null +++ b/tests/install-uninstall.sh @@ -0,0 +1,49 @@ +#!/bin/sh +set -u + +. aux/tests-lib.sh + +TEST_DESTDIR="$PWD/tests/destdirs/$(uuidgen)" +PATH="$TEST_DESTDIR/usr/local/bin:$PATH" + +test_install_uninstall_targets() { + testing 'install uninstall targets' + + OUT="$(mktemp)" + ERR="$(mktemp)" + make DESTDIR="$TEST_DESTDIR" install 1>"$OUT" 2>"$ERR" + git permalink -V 1>"$OUT" 2>"$ERR" + STATUS=$? + assert_status 0 + assert_grep_stdout '^git-permalink-[0-9\.]+ [0-9-]+$' + assert_empty_stderr + + OUT="$(mktemp)" + ERR="$(mktemp)" + find "$TEST_DESTDIR" -type f | wc -l 1>"$OUT" 2>"$ERR" + STATUS=$? + assert_status 0 + assert_stdout '5' + assert_empty_stderr + + OUT="$(mktemp)" + ERR="$(mktemp)" + make DESTDIR="$TEST_DESTDIR" uninstall 1>"$OUT" 2>"$ERR" + LANG=POSIX git permalink -V 1>"$OUT" 2>"$ERR" + STATUS=$? + assert_status 1 + assert_empty_stdout + assert_fgrep_stderr 'not a git command' + + OUT="$(mktemp)" + ERR="$(mktemp)" + find "$TEST_DESTDIR" -type f | wc -l 1>"$OUT" 2>"$ERR" + STATUS=$? + assert_status 0 + assert_stdout '0' + assert_empty_stderr + + test_ok +} + +test_install_uninstall_targets |