summaryrefslogtreecommitdiff
path: root/test/librefetch-test.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-09-30 00:27:23 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-10-01 17:35:22 -0400
commit4014f6c2cc579645aac56f51aa6063db7815c3a8 (patch)
tree549afea90ba2a0283c1507cd276a28d3e4fb243a /test/librefetch-test.sh
parent61e61226d8aeb2a973656a263cd0c523e9e55c88 (diff)
test: Clean up (config) file writing
Instead of using in inconsistent mish-mash of `mkdir` and `echo >` and `printf >>`, use more readable and identifiable indented-heredocs: install -Dm644 /dev/stdin "FILENAME" <<-eot CONTENTS eot
Diffstat (limited to 'test/librefetch-test.sh')
-rw-r--r--test/librefetch-test.sh33
1 files changed, 16 insertions, 17 deletions
diff --git a/test/librefetch-test.sh b/test/librefetch-test.sh
index 5ee5ba3..8cc7281 100644
--- a/test/librefetch-test.sh
+++ b/test/librefetch-test.sh
@@ -6,25 +6,24 @@ describe librefetch
before() {
common_before
- mkdir -p "$XDG_CONFIG_HOME"/{pacman,libretools} "$tmpdir/workdir/srcdest"
-
- cat <<EOF > "$XDG_CONFIG_HOME/pacman/makepkg.conf"
-DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
- 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
- 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
- 'rsync::/usr/bin/rsync --no-motd -z %u %o'
- 'scp::/usr/bin/scp -C %u %o')
-BUILDDIR=""
-SRCDEST=$tmpdir/workdir/srcdest
-source ${_librelib_conf_sh_sysconfdir}/makepkg.d/librefetch.conf
-EOF
-
+ mkdir -p "$tmpdir/workdir/srcdest"
+
+ install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
+ DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
+ 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
+ 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
+ 'rsync::/usr/bin/rsync --no-motd -z %u %o'
+ 'scp::/usr/bin/scp -C %u %o')
+ BUILDDIR=""
+ SRCDEST=${tmpdir@Q}/workdir/srcdest
+ source ${_librelib_conf_sh_sysconfdir@Q}/makepkg.d/librefetch.conf
+ eot
export MAKEPKG_CONF="$XDG_CONFIG_HOME/pacman/makepkg.conf"
- printf '%s\n' \
- 'MIRRORS=("phony://example.com/dir/")' \
- 'DOWNLOADER=/usr/bin/false' \
- > "$XDG_CONFIG_HOME/libretools/librefetch.conf"
+ install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/librefetch.conf" <<-eot
+ MIRRORS=("phony://example.com/dir/")
+ DOWNLOADER=/usr/bin/false
+ eot
}
it_displays_help() {