#!/bin/bash # # Script to accept the current output for some output comparing test as the golden output # # Usage: accept # # Will copy build/tests/.output to tests/.expected if [ "$#" -ne 1 ] then echo "Usage: accept " exit 1 fi scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" rootdir=$(dirname $scriptdir) if [[ ! -f $rootdir/build/tests/$1.output ]] then echo "Output file does not exist." exit fi echo "About to 'cp build/tests/$1.output tests/$1.expected'" read -r -p "Are you sure? [y/N] " response if [[ ! $response =~ ^([yY][eE][sS]|[yY])$ ]] then exit fi cp $rootdir/build/tests/$1.output $rootdir/tests/$1.expected echo "Accepted!"