aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-22 16:15:29 -0300
committerEuAndreh <eu@euandre.org>2021-06-22 16:15:29 -0300
commitafecd9fc874922c01676cbb871a5159867a1ee67 (patch)
tree646a1b8d4a026fcbeab55632da04a45d2829dfa3
parentsrc/git-permalink.sh.in: Remove empty lines across translated string variables (diff)
downloadgit-permalink-afecd9fc874922c01676cbb871a5159867a1ee67.tar.gz
git-permalink-afecd9fc874922c01676cbb871a5159867a1ee67.tar.xz
tests/install-uninstall.sh: Add
-rw-r--r--Makefile1
-rwxr-xr-xtests/install-uninstall.sh49
2 files changed, 50 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6d6c38e..c5efa58 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ git-permalink: src/git-permalink.sh.in
check: all
sh tests/cli-opts.sh
+ sh tests/install-uninstall.sh
dev-check: check
sh aux/assert-shellcheck.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