diff options
| author | Paul Buetow <git@mx.buetow.org> | 2021-05-19 12:36:21 +0100 |
|---|---|---|
| committer | Paul Buetow <git@mx.buetow.org> | 2021-05-19 12:36:21 +0100 |
| commit | faa2cd392016af9b76a4f40eeb12003785ced15e (patch) | |
| tree | e9c8a2ef2db86ed9a31ea545c3fb37642141b20d /packages/assert.source.sh | |
| parent | 995140a869c86929318d990232aff50feb9f11b2 (diff) | |
dedicated gemtext 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" -} |
