diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-09-30 00:27:23 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-10-01 17:35:22 -0400 |
commit | 4014f6c2cc579645aac56f51aa6063db7815c3a8 (patch) | |
tree | 549afea90ba2a0283c1507cd276a28d3e4fb243a /test/librestage-test.sh | |
parent | 61e61226d8aeb2a973656a263cd0c523e9e55c88 (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/librestage-test.sh')
-rw-r--r-- | test/librestage-test.sh | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/test/librestage-test.sh b/test/librestage-test.sh index 8caf5d6..4f617ca 100644 --- a/test/librestage-test.sh +++ b/test/librestage-test.sh @@ -6,15 +6,15 @@ describe librestage before() { common_before - mkdir -p $XDG_CONFIG_HOME/libretools - echo "WORKDIR='$tmpdir/workdir'" > $XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + WORKDIR=${tmpdir@Q}/workdir + eot - mkdir -p $XDG_CONFIG_HOME/pacman - { - printf 'PKGDEST=%q\n' "$tmpdir/workdir/pkgdest" - printf 'SRCPKGDEST=%q\n' "$tmpdir/workdir/srcpkgdest" - echo "PACKAGER='Test Suite <test@localhost>'" - } >$XDG_CONFIG_HOME/pacman/makepkg.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot + PKGDEST=${tmpdir@Q}/workdir/pkgdest + SRCPKGDEST=${tmpdir@Q}/workdir/srcpkgdest + PACKAGER='Test Suite <test@localhost>' + eot mkdir -p "$tmpdir/workdir/pkgdest" mkdir -p "$tmpdir/workdir/srcpkgdest" @@ -66,8 +66,10 @@ it_guesses_the_repo() { it_stages_packages_without_PKGDEST() { nochroot=false; require network sudo || nochroot=true - echo "PKGDEST=''" >> $XDG_CONFIG_HOME/pacman/makepkg.conf - echo "SRCPKGDEST=''" >> $XDG_CONFIG_HOME/pacman/makepkg.conf + cat >> "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot + PKGDEST='' + SRCPKGDEST='' + eot cp librestage.d/PKGBUILD-hello "$tmpdir/PKGBUILD" cd "$tmpdir" |