aboutsummaryrefslogtreecommitdiffstats
path: root/test_merge.bash
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2013-09-25 10:37:52 -0700
committerClint Byrum <clint@fewbar.com>2013-09-25 11:24:06 -0700
commitcd3ddc482fff7d96341a33613f78da0cbbbecdf4 (patch)
treefdb13afa00e8127fad2a094add1739eb5e3fefa3 /test_merge.bash
parent0dbf2810a0ee78658c35e61dc447c5f968226cb9 (diff)
Refactor test_merge.bash for multiple tests
We will be adding more tests, so make it more of a framework for that. Also fix up minor lib.yaml formatting bug. Change-Id: Ic0fe1679f8d62680dfd0acf215c849aa38b913da
Diffstat (limited to 'test_merge.bash')
-rw-r--r--test_merge.bash33
1 files changed, 19 insertions, 14 deletions
diff --git a/test_merge.bash b/test_merge.bash
index 35390aaa..004a613e 100644
--- a/test_merge.bash
+++ b/test_merge.bash
@@ -7,18 +7,23 @@ cleanup() {
fi
}
trap cleanup EXIT
-result=$(mktemp /tmp/test_merge.XXXXXX)
-fail=0
-python merge.py examples/source.yaml > $result
-if ! cmp $result examples/source_lib_result.yaml ; then
- diff -u $result examples/source_lib_result.yaml
- echo
- echo FAIL - merge of source.yaml result does not match expected output
- echo
- fail=1
-else
- echo
- echo PASS - merge of source.yaml result matches expected output
- echo
-fi
+run_test() {
+ local cmd=$1
+ local expected=$2
+ result=$(mktemp /tmp/test_merge.XXXXXX)
+ fail=0
+ $cmd > $result
+ if ! cmp $result $expected ; then
+ diff -u $expected $result || :
+ echo FAIL - $cmd result does not match expected
+ fail=1
+ else
+ echo PASS - $cmd
+ fi
+ cleanup
+}
+echo
+run_test "python merge.py examples/source.yaml" examples/source_lib_result.yaml
+echo
+trap - EXIT
exit $fail