diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-09 13:21:29 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-09 13:21:29 +0300 |
| commit | b253915c629c6d38641a81c7f1bb47d662c48a03 (patch) | |
| tree | bdd494eff528c68cf26ce2bd18bf87c6c2a66d41 /lib/assert.source.sh | |
| parent | fed1dbf0d164a18b01843323b676d1bff3f628da (diff) | |
add support for GNU Source Highlight - for Source code highlighting in bare blocks
Diffstat (limited to 'lib/assert.source.sh')
| -rw-r--r-- | lib/assert.source.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/assert.source.sh b/lib/assert.source.sh index a1713c3..990194c 100644 --- a/lib/assert.source.sh +++ b/lib/assert.source.sh @@ -31,6 +31,20 @@ assert::not_empty () { log VERBOSE "Result in $callee as expected not empty" } +# Unit test for whether a given string contains a substring +assert::contains () { + local -r content="$1"; shift + local -r substring="$1"; shift + local -r callee=${FUNCNAME[1]} + + if ! $GREP -q -F "$substring" <<< "$content"; then + log ERROR "In $callee expected '$content' to contain substring '$substring'" + exit 2 + fi + + log VERBOSE "Substring check in $callee as expected, contains '$substring'" +} + # Unit test for whether a given string matches a regex. assert::matches () { local -r name="$1"; shift |
