From 5c0109af811bf41a48eefaedde393558093d635a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Tue, 13 Aug 2013 01:34:46 +0200 Subject: [PATCH] add tests for checking that -f and +f prints the specified pony MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- dev/tests/correct-pony+f | 34 ++++++++++++++++++++++++++++++++++ dev/tests/correct-pony-f | 34 ++++++++++++++++++++++++++++++++++ dev/tests/test-everything | 10 ++++++++++ 3 files changed, 78 insertions(+) create mode 100755 dev/tests/correct-pony+f create mode 100755 dev/tests/correct-pony-f create mode 100755 dev/tests/test-everything diff --git a/dev/tests/correct-pony+f b/dev/tests/correct-pony+f new file mode 100755 index 00000000..61f5c177 --- /dev/null +++ b/dev/tests/correct-pony+f @@ -0,0 +1,34 @@ +#!/bin/bash + +if [ ! -f ./src/__main__.py ]; then + echo $'\e[01;31m-- You need to cd into the repository'\'$'s root directory --\e[00m' + exit 140 +fi + +echo $'\e[1m-- Testing that +f prints the correct pony --\e[0m' + +## If this automated bisection stops at a commit with a syntax error or other error that cases the test to fail for another reason, +## you will need to manually run bisect, and use `git reset --hard HEAD~1` (or similar) to skip that commit, see `git bisect --help` + +if [ ! "$(./src/__main__.py -oX +f firefox 3>&1 >/dev/null | head -n 1)" = "pony file: ./extraponies/firefox.pony" ]; then + git bisect start + git bisect bad + git bisect good d234ee6c6cbefbd31ef763692c9f8bc39aeff832 + lastlog="" + while true; do + if [ "$(./src/__main__.py -oX +f firefox 3>&1 >/dev/null | head -n 1)" = "pony file: ./extraponies/firefox.pony" ]; then + git bisect good + else + git bisect bad + fi + # This part is a little hacky as I assume git use locale settings for the language and there seems to be no good way to automate a bisect. + nowlog="$(git bisect log | tail -n 1)" + if [ "${nowlog}" = "${lastlog}" ]; then + git checkout master + exit 1 + fi + done +fi + +echo 'Test was passed, you may want to update the last know good commit in ./dev/tests/correct-pony+f' + diff --git a/dev/tests/correct-pony-f b/dev/tests/correct-pony-f new file mode 100755 index 00000000..253c7fa9 --- /dev/null +++ b/dev/tests/correct-pony-f @@ -0,0 +1,34 @@ +#!/bin/bash + +if [ ! -f ./src/__main__.py ]; then + echo $'\e[01;31m-- You need to cd into the repository'\'$'s root directory --\e[00m' + exit 140 +fi + +echo $'\e[1m-- Testing that -f prints the correct pony --\e[0m' + +## If this automated bisection stops at a commit with a syntax error or other error that cases the test to fail for another reason, +## you will need to manually run bisect, and use `git reset --hard HEAD~1` (or similar) to skip that commit, see `git bisect --help` + +if [ ! "$(./src/__main__.py -oX -f sweetiesing 3>&1 >/dev/null | head -n 1)" = "pony file: ./ponies/sweetiesing.pony" ]; then + git bisect start + git bisect bad + git bisect good d234ee6c6cbefbd31ef763692c9f8bc39aeff832 + lastlog="" + while true; do + if [ "$(./src/__main__.py -oX -f sweetiesing 3>&1 >/dev/null | head -n 1)" = "pony file: ./ponies/sweetiesing.pony" ]; then + git bisect good + else + git bisect bad + fi + # This part is a little hacky as I assume git use locale settings for the language and there seems to be no good way to automate a bisect. + nowlog="$(git bisect log | tail -n 1)" + if [ "${nowlog}" = "${lastlog}" ]; then + git checkout master + exit 1 + fi + done +fi + +echo 'Test was passed, you may want to update the last know good commit in ./dev/tests/correct-pony-f' + diff --git a/dev/tests/test-everything b/dev/tests/test-everything new file mode 100755 index 00000000..9cc9076f --- /dev/null +++ b/dev/tests/test-everything @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ ! -f ./src/__main__.py ]; then + echo $'\e[01;31m-- You need to cd into the repository'\'$'s root directory --\e[00m' + exit 140 +fi + +./dev/tests/correct-pony-f +./dev/tests/correct-pony+f +