Tests: Move preamble out of t/run

pull/55/head
Adrian Perez de Castro 2016-08-17 13:35:49 +03:00
parent 3df2d5f715
commit 85ad712764
No known key found for this signature in database
GPG Key ID: 91C559DBE4C9123B
2 changed files with 19 additions and 13 deletions

18
t/preamble Normal file
View File

@ -0,0 +1,18 @@
#! /bin/bash
#
# preamble
# Copyright (C) 2016 Adrian Perez <aperez@igalia.com>
#
# Distributed under terms of the MIT license.
#
function fail () {
printf "(FF) "
printf "$@"
exit 1
} 1>&2
function warn () {
printf "(WW)"
printf "$@"
} 1>&2

14
t/run
View File

@ -17,18 +17,6 @@ if [[ $# -gt 1 && $2 -eq 1 ]] ; then
fi
readonly dynamic
readonly preamble='
function fail () {
printf "(FF) "
printf "$@"
exit 1
} 1>&2
function warn () {
printf "(WW)"
printf "$@"
} 1>&2
'
declare -a t_pass=( )
declare -a t_fail=( )
@ -40,9 +28,9 @@ for t in "$T"/*.test ; do
outfile="${name}.out"
shfile="${name}.sh"
cat > "${shfile}" <<-EOF
${preamble}
readonly PREFIX='${prefix}'
readonly DYNAMIC=${dynamic}
$(< "$T/preamble")
$(< "$t")
EOF
if bash -e "${shfile}" > "${outfile}" 2> "${errfile}" ; then