From 4014f6c2cc579645aac56f51aa6063db7815c3a8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 30 Sep 2018 00:27:23 -0400 Subject: 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 --- test/librefetch-test.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'test/librefetch-test.sh') 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 < "$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() { -- cgit v1.2.2