From afecd9fc874922c01676cbb871a5159867a1ee67 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 22 Jun 2021 16:15:29 -0300 Subject: tests/install-uninstall.sh: Add --- tests/install-uninstall.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 tests/install-uninstall.sh (limited to 'tests/install-uninstall.sh') 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 -- cgit v1.2.3