tests: fixed aliasing and created mm.sh

This commit is contained in:
Emma Tebibyte 2024-04-24 15:22:07 -06:00
parent 057f5571d6
commit aefa87d9e5
Signed by: emma
GPG Key ID: 06FA419A1698C270
8 changed files with 33 additions and 2 deletions

3
tests/bonsai/aliases Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
alias "$UTIL=$BIN/$UTIL"

View File

@ -7,6 +7,8 @@
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved. This file is offered as-is, without any warranty.
. tests/bonsai/aliases
! dj -h
# This test is theoretically Linux-dependent; write(2) should return -1 on

View File

@ -7,5 +7,7 @@
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved. This file is offered as-is, without any warranty.
. tests/bonsai/aliases
! false
! false -h

View File

@ -7,6 +7,8 @@
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved. This file is offered as-is, without any warranty.
. tests/bonsai/aliases
intcmp -e 3 3 3
intcmp -g 3 2 1
intcmp -l 1 2 3

20
tests/bonsai/mm.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Copyright (c) 2024 DTB <trinity@trinity.moe>
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
# SPDX-License-Identifier: FSFAP
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved. This file is offered as-is, without any warranty.
. tests/bonsai/aliases
exec 3>&1
! mm -h
# mm(1) will error if positional arguments are given without -i or -o
! mm argument
# check if stderr is empty upon specifying -e
! "$BIN/strcmp" "$(printf 'test\n' | mm -i - -e 2>&1 1>&3)" ''

View File

@ -7,6 +7,8 @@
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved. This file is offered as-is, without any warranty.
. tests/bonsai/aliases
strcmp equals equals
! strcmp inequals equals
strcmp - -

View File

@ -7,5 +7,7 @@
# permitted in any medium without royalty provided the copyright notice and this
# notice are preserved. This file is offered as-is, without any warranty.
. tests/bonsai/aliases
true
true -h

View File

@ -23,8 +23,6 @@ for script in tests/bonsai/*.sh; do
export UTIL="$(printf '%s\n' "$script" \
| sed -e 's/\.sh//g' -e 's;tests\/bonsai\/;;g')"
alias "$UTIL"="$BIN/$UTIL"
printf '%s: %s: Testing utility.\n' "$0" "$UTIL"
"$script"
printf '\n'