diff options
| author | Paul Buetow <git@mx.buetow.org> | 2021-05-19 12:39:49 +0100 |
|---|---|---|
| committer | Paul Buetow <git@mx.buetow.org> | 2021-05-19 12:39:49 +0100 |
| commit | 27ed46c9129db86669052d4e7211340da1081d89 (patch) | |
| tree | 971b3da55d8bc2630503645ff9ac6a41e73fb468 /packages/assert.source.sh | |
| parent | 752c272ef2c120904c069440117b12940770eb9f (diff) | |
html branch
Diffstat (limited to 'packages/assert.source.sh')
| -rw-r--r-- | packages/assert.source.sh | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/packages/assert.source.sh b/packages/assert.source.sh deleted file mode 100644 index 5d3a5c5d..00000000 --- a/packages/assert.source.sh +++ /dev/null @@ -1,47 +0,0 @@ -# Unit test for whether 2 given strings equal. -assert::equals () { - local -r result="$1"; shift - local -r expected="$1"; shift - local -r callee=${FUNCNAME[1]} - - if [[ "$result" != "$expected" ]]; then - cat <<ERROR | log::pipe ERROR -In $callee expected - '$expected' -But got - '$result' -ERROR - exit 2 - fi - - log VERBOSE "Result in $callee as expected: '$expected'" -} - -# Unit test for whether a given string is not empty. -assert::not_empty () { - local -r name="$1"; shift - local -r content="$1"; shift - local -r callee=${FUNCNAME[1]} - - if [ -z "$content" ]; then - log ERROR "In $callee expected '$name' not to be empty!" - exit 2 - fi - - log VERBOSE "Result in $callee as expected not empty" -} - -# Unit test for whether a given string matches a regex. -assert::matches () { - local -r name="$1"; shift - local -r content="$1"; shift - local -r regex="$1"; shift - local -r callee=${FUNCNAME[1]} - - if ! $GREP -q -E "$regex" <<< "$content"; then - log ERROR "In $callee expected '$name' to match '$regex'" - exit 2 - fi - - log VERBOSE "Matching in $callee as expected" -} |
