summaryrefslogtreecommitdiff
path: root/lib/assert.source.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/assert.source.sh')
-rw-r--r--lib/assert.source.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/assert.source.sh b/lib/assert.source.sh
new file mode 100644
index 00000000..3367809d
--- /dev/null
+++ b/lib/assert.source.sh
@@ -0,0 +1,16 @@
+assert::equals () {
+ local -r result="$1"; shift
+ local -r expected="$1"; shift
+
+ if [ "$result" != "$expected" ]; then
+ cat <<ERROR
+Expected
+ '$expected'
+But got
+ '$result'
+ERROR
+ exit 2
+ fi
+
+ echo "Assert OK: $expected"
+}