diff options
Diffstat (limited to 'test/librerelease-test.sh')
-rw-r--r-- | test/librerelease-test.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/librerelease-test.sh b/test/librerelease-test.sh new file mode 100644 index 0000000..a44b150 --- /dev/null +++ b/test/librerelease-test.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env roundup + +describe librestage + +. ./test-common.sh + +before() { + _before + + mkdir -p $XDG_CONFIG_HOME/libretools + { + echo "WORKDIR='$tmpdir/workdir'" + echo 'REPODEST=repo@repo:/srv/http/repo/staging-$LIBREUSER' + } >$XDG_CONFIG_HOME/libretools/libretools.conf + { + echo 'PKGEXT=.pkg.tar.gz' + echo "PKGDEST='$tmpdir/workdir/pkgdest'" + echo "GPGKEY=YOURKEY" + } > $HOME/.makepkg.conf + mkdir -p "$tmpdir/workdir/pkgdest" +} + +after() { + _after +} + +it_displays_usage_text() { + rm -rf "$XDG_CONFIG_HOME" + LC_ALL=C librerelease -h >"$tmpdir/stdout" 2>"$tmpdir/stderr" + + [[ "$(sed 1q "$tmpdir/stdout")" =~ Usage:.* ]] + empty "$tmpdir/stderr" +} + +it_lists_all_files() { + WORKDIR="$tmpdir/workdir" + mkdir -p "$WORKDIR/staging/repo1" "$WORKDIR/staging/repo2/sub" + touch \ + "$WORKDIR/staging/repo1/file1" \ + "$WORKDIR/staging/repo1/file2" \ + "$WORKDIR/staging/repo2/file with spaces" \ + "$WORKDIR/staging/repo2/sub/subfolder" + unset WORKDIR + LC_ALL=C librerelease -l &>"$tmpdir/list" + + cat > "$tmpdir/list-correct" <<EOF + -> repo1 + file1 + file2 + -> repo2 + file with spaces + sub/subfolder +EOF + + diff "$tmpdir/list-correct" "$tmpdir/list" +} |