34 lines
332 B
Bash
34 lines
332 B
Bash
#!/bin/bash
|
|
|
|
lastgiven=''
|
|
lastexpected=''
|
|
|
|
last()
|
|
{
|
|
lastgiven="$1"
|
|
lastexpected="$2"
|
|
}
|
|
|
|
|
|
assert-equal()
|
|
{
|
|
last "$1" "$2"
|
|
[ "$1" == "$2" ]
|
|
}
|
|
|
|
|
|
assert-eq()
|
|
{
|
|
last "$1" "$2"
|
|
[ $1 -eq $2 ]
|
|
}
|
|
|
|
|
|
fail()
|
|
{
|
|
echo "FAILURE: $1" >&2
|
|
echo "Expected '$lastexpected', but received '$lastgiven'" >&2
|
|
echo >&2
|
|
}
|
|
|