diff options
| author | Joel Martin <github@martintribe.org> | 2014-03-24 16:32:24 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-03-24 16:32:24 -0500 |
| commit | 3169070063b2cb877200117ebb384269d73bcb93 (patch) | |
| tree | 23de3db1ea5c37afd21a45b6ed7771f56a08c0c4 /bash/tests/common.sh | |
| download | mal-3169070063b2cb877200117ebb384269d73bcb93.tar.gz mal-3169070063b2cb877200117ebb384269d73bcb93.zip | |
Current state of mal for Clojure West lighting talk.
Diffstat (limited to 'bash/tests/common.sh')
| -rw-r--r-- | bash/tests/common.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bash/tests/common.sh b/bash/tests/common.sh new file mode 100644 index 0000000..9924107 --- /dev/null +++ b/bash/tests/common.sh @@ -0,0 +1,25 @@ + +assert () { + if ! eval "${2}"; then + echo "assert failure line ${1}" + exit 1 + fi +} + +assert_eq () { + if eval "${3}"; then + if [[ "${2}" != "${r}" ]]; then + echo "assert_eq failure line ${1}: '${2}' != '${r}'" + exit 1 + fi + else + echo "assert_eq failure line ${1}: could not evaluate '${3}'" + exit 1 + fi +} + +TEST_RE () { + r= + READ_STR "${1}" + EVAL "${r}" ${REPL_ENV} +} |
