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/librestage-test.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'test/librestage-test.sh') 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 '" - } >$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 ' + 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" -- cgit v1.2.2