proj/gagit:main commit in: /, test/
MichaŠGórny <[email protected]> Wed, 05 Aug 2026 11:34:22 +0000 (UTC)
| Newsgroups | gmane.linux.gentoo.cvs |
|---|---|
| Message-ID | <1785928156.537d2a4a6f8a6afe2b1d32f5ed73e278417df731.mgorny@gentoo> |
commit: 537d2a4a6f8a6afe2b1d32f5ed73e278417df731
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 5 11:09:16 2026 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Aug 5 11:09:16 2026 +0000
URL: https://gitweb.gentoo.org/proj/gagit.git/commit/?id=537d2a4a
Add a test harness and first test
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
meson.build | 11 +++++++++++
test/00no-repository.sh | 13 +++++++++++++
2 files changed, 24 insertions(+)
diff --git a/meson.build b/meson.build
index 13eb423..b168d63 100644
--- a/meson.build
+++ b/meson.build
@@ -8,3 +8,14 @@ project('gagit',
install_data('gagit',
install_dir: get_option('bindir'),
install_mode: 'rwxr-xr-x')
+
+bash = find_program('bash')
+tests = [
+ '00no-repository',
+]
+
+foreach t : tests
+ test(t, bash,
+ args: [t + '.sh'],
+ workdir: meson.current_source_dir() / 'test')
+endforeach
diff --git a/test/00no-repository.sh b/test/00no-repository.sh
new file mode 100755
index 0000000..8ceaf46
--- /dev/null
+++ b/test/00no-repository.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Test whether a clear error is given when not in a repository.
+
+set -e -x
+
+INITDIR=${PWD}
+TEMPDIR=$(mktemp -d)
+trap 'rm -rf "${TEMPDIR}"' EXIT
+
+cd "${TEMPDIR}"
+
+STDERR=$(! bash "${INITDIR}"/../gagit -e false -n 2>&1 >/dev/null)
+[[ ${STDERR} == *'needs to be run inside a git checkout'* ]]