golang-client/examples/run-all.sh
Matt Farina 7eef44f0c8 Adding examples that can optionally be used as acceptance tests.
Change-Id: Ie13680476865ece878a1c3486bbc3fd61c0d41b9
2014-05-22 10:01:03 -04:00

20 lines
434 B
Bash
Executable File

#!/bin/bash
#
# Enables all the examples to execute as a form of acceptance testing.
# Get the directory the examples are in and change into it.
DIR="$(cd $(dirname "$0") && pwd)"
echo "Executing the examples in: $DIR"
cd $DIR
# Run all the tests.
for T in $(ls -1 [0-9][0-9]*.go); do
if ! [ -x $T ]; then
CMD="go run $T setup.go"
echo "$CMD ..."
if ! $CMD ; then
echo "Error executing example $T."
exit 1
fi
fi
done