mirror of
https://github.com/hectorm/hblock.git
synced 2026-04-20 05:56:28 +05:30
33 lines
859 B
Bash
Executable file
33 lines
859 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# Author: Héctor Molinero Fernández <hector@molinero.dev>
|
|
# License: MIT, https://opensource.org/licenses/MIT
|
|
# Repository: https://github.com/hectorm/hblock
|
|
|
|
set -eu
|
|
export LC_ALL='C'
|
|
|
|
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)"
|
|
|
|
# shellcheck disable=SC1090
|
|
. "${SCRIPT_DIR:?}"/env.sh
|
|
|
|
main() {
|
|
export HBLOCK_REDIRECTION='0.0.0.0'
|
|
|
|
printf -- 'Test - Main: "-R" short option\n'
|
|
actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -R '::1')"
|
|
expected="$(cat -- "${0%.sh}".out)"
|
|
if ! assertEquals "${actual?}" "${expected?}"; then
|
|
exit 1
|
|
fi
|
|
|
|
printf -- 'Test - Main: "--redirection" long option\n'
|
|
actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --redirection='::1')"
|
|
expected="$(cat -- "${0%.sh}".out)"
|
|
if ! assertEquals "${actual?}" "${expected?}"; then
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
main "${@-}"
|