From e34217ee24c462e0340f0a801441ce0adadee5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Sun, 28 Feb 2021 16:27:42 +0100 Subject: [PATCH] Removed double dash from "printf". It's not necessary and the Toybox implementation interprets it literally. --- hblock | 48 +++++++++---------- resources/index/index.sh | 12 ++--- resources/packaging/apkbuild/APKBUILD.m4 | 2 +- resources/packaging/deb/debian/changelog.m4 | 4 +- resources/packaging/npm/package.json.m4 | 2 +- resources/packaging/pkgbuild/PKGBUILD.m4 | 2 +- resources/packaging/rpm/SPECS/hblock.spec.m4 | 2 +- resources/stats/stats.sh | 6 +-- resources/tests/env.sh | 6 +-- .../test-main-argument-double-dash-arg.sh | 2 +- .../test-main-argument-invalid-long-opt.sh | 2 +- .../test-main-argument-invalid-short-opt.sh | 2 +- .../tests/test-main-feature-allowlist.sh | 18 +++---- resources/tests/test-main-feature-comment.sh | 6 +-- resources/tests/test-main-feature-denylist.sh | 18 +++---- .../test-main-feature-filter-subdomains.sh | 8 ++-- resources/tests/test-main-feature-footer.sh | 18 +++---- resources/tests/test-main-feature-header.sh | 18 +++---- resources/tests/test-main-feature-lenient.sh | 8 ++-- .../tests/test-main-feature-redirection.sh | 6 +-- resources/tests/test-main-feature-regex.sh | 8 ++-- resources/tests/test-main-feature-template.sh | 6 +-- resources/tests/test-main-feature-wrap.sh | 6 +-- resources/tests/test-stats-suffixes.sh | 2 +- resources/tests/test-stats-tlds.sh | 2 +- resources/version/version.sh | 2 +- 26 files changed, 108 insertions(+), 108 deletions(-) diff --git a/hblock b/hblock index ed891d8..d7df16e 100755 --- a/hblock +++ b/hblock @@ -136,13 +136,13 @@ optArgBool() { else optArg='false'; fi } optDie() { - printf -- '%s\n' "${@-}" "Try 'hblock --help' for more information" >&2 + printf '%s\n' "${@-}" "Try 'hblock --help' for more information" >&2 exit 2 } # Show help and quit. showHelp() { - printf -- '%s\n' "$(sed -e 's/%NL/\n/g' <<-EOF + printf '%s\n' "$(sed -e 's/%NL/\n/g' <<-EOF Usage: hblock [OPTION]... hBlock is a POSIX-compliant shell script that gets a list of domains that serve @@ -248,7 +248,7 @@ showHelp() { # Show version number and quit. showVersion() { getMetadata() { sed -ne 's|^# '"${1:?}"':[[:blank:]]*\(.\{1,\}\)$|\1|p' -- "${0:?}"; } - printf -- '%s\n' "$(cat <<-EOF + printf '%s\n' "$(cat <<-EOF hBlock $(getMetadata 'Version') Author: $(getMetadata 'Author') License: $(getMetadata 'License') @@ -269,22 +269,22 @@ exists() { # Pretty print methods. printInfo() { if [ "${quiet-}" != 'true' ]; then - if [ "${color-}" != 'true' ]; then printf -- '[INFO] %s\n' "${@-}" - else printf -- '\033[0m[\033[1;32mINFO\033[0m] %s\n' "${@-}"; fi + if [ "${color-}" != 'true' ]; then printf '[INFO] %s\n' "${@-}" + else printf '\033[0m[\033[1;32mINFO\033[0m] %s\n' "${@-}"; fi fi } printWarn() { - if [ "${color-}" != 'true' ]; then printf -- '[WARN] %s\n' "${@-}" >&2 - else printf -- '\033[0m[\033[1;33mWARN\033[0m] %s\n' "${@-}" >&2; fi + if [ "${color-}" != 'true' ]; then printf '[WARN] %s\n' "${@-}" >&2 + else printf '\033[0m[\033[1;33mWARN\033[0m] %s\n' "${@-}" >&2; fi } printError() { - if [ "${color-}" != 'true' ]; then printf -- '[ERROR] %s\n' "${@-}" >&2 - else printf -- '\033[0m[\033[1;31mERROR\033[0m] %s\n' "${@-}" >&2; fi + if [ "${color-}" != 'true' ]; then printf '[ERROR] %s\n' "${@-}" >&2 + else printf '\033[0m[\033[1;31mERROR\033[0m] %s\n' "${@-}" >&2; fi } printList() { if [ "${quiet-}" != 'true' ]; then - if [ "${color-}" != 'true' ]; then printf -- ' * %s\n' "${@-}" - else printf -- '\033[0m \033[1;36m*\033[0m %s\n' "${@-}"; fi + if [ "${color-}" != 'true' ]; then printf ' * %s\n' "${@-}" + else printf '\033[0m \033[1;36m*\033[0m %s\n' "${@-}"; fi fi } @@ -297,7 +297,7 @@ rand() { mktempFile() { # POSIX does not specify the mktemp utility, so here comes a hacky solution. while file="${TMPDIR:-${TMP:-/tmp}}/hblock.${$}.$(rand)" && [ -e "${file:?}" ]; do sleep 1; done - (umask 077 && touch -- "${file:?}"); printf -- '%s' "${file:?}" + (umask 077 && touch -- "${file:?}"); printf '%s' "${file:?}" } # Write stdin to a file. @@ -461,7 +461,7 @@ main() { # Parse command line options. # shellcheck disable=SC2086 - { optParse "${@-}"; set -- ${posArgs-}; } + { optParse "${@-}"; set -- ${posArgs-} >/dev/null; } if [ "${color:?}" = 'auto' ]; then # Check color support, but honor ${NO_COLOR} variable (https://no-color.org). @@ -479,7 +479,7 @@ main() { # If the file value equals "none", use an empty file. 'none') headerFile="$(mktempFile)"; true > "${headerFile:?}" ;; # If the file value equals "builtin", use the built-in value. - 'builtin') headerFile="$(mktempFile)"; printf -- '%s' "${HBLOCK_HEADER_BUILTIN?}" > "${headerFile:?}" ;; + 'builtin') headerFile="$(mktempFile)"; printf '%s' "${HBLOCK_HEADER_BUILTIN?}" > "${headerFile:?}" ;; # If the file does not exist, throw an error. *) [ -e "${headerFile:?}" ] || { printError "No such file: ${headerFile:?}"; exit 1; } ;; esac @@ -491,7 +491,7 @@ main() { # If the file value equals "none", use an empty file. 'none') footerFile="$(mktempFile)"; true > "${footerFile:?}" ;; # If the file value equals "builtin", use the built-in value. - 'builtin') footerFile="$(mktempFile)"; printf -- '%s' "${HBLOCK_FOOTER_BUILTIN?}" > "${footerFile:?}" ;; + 'builtin') footerFile="$(mktempFile)"; printf '%s' "${HBLOCK_FOOTER_BUILTIN?}" > "${footerFile:?}" ;; # If the file does not exist, throw an error. *) [ -e "${footerFile:?}" ] || { printError "No such file: ${footerFile:?}"; exit 1; } ;; esac @@ -503,7 +503,7 @@ main() { # If the file value equals "none", use an empty file. 'none') sourcesFile="$(mktempFile)"; true > "${sourcesFile:?}" ;; # If the file value equals "builtin", use the built-in value. - 'builtin') sourcesFile="$(mktempFile)"; printf -- '%s' "${HBLOCK_SOURCES_BUILTIN?}" > "${sourcesFile:?}" ;; + 'builtin') sourcesFile="$(mktempFile)"; printf '%s' "${HBLOCK_SOURCES_BUILTIN?}" > "${sourcesFile:?}" ;; # If the file does not exist, throw an error. *) [ -e "${sourcesFile:?}" ] || { printError "No such file: ${sourcesFile:?}"; exit 1; } ;; esac @@ -515,7 +515,7 @@ main() { # If the file value equals "none", use an empty file. 'none') allowlistFile="$(mktempFile)"; true > "${allowlistFile:?}" ;; # If the file value equals "builtin", use the built-in value. - 'builtin') allowlistFile="$(mktempFile)"; printf -- '%s' "${HBLOCK_ALLOWLIST_BUILTIN?}" > "${allowlistFile:?}" ;; + 'builtin') allowlistFile="$(mktempFile)"; printf '%s' "${HBLOCK_ALLOWLIST_BUILTIN?}" > "${allowlistFile:?}" ;; # If the file does not exist, throw an error. *) [ -e "${allowlistFile:?}" ] || { printError "No such file: ${allowlistFile:?}"; exit 1; } ;; esac @@ -527,7 +527,7 @@ main() { # If the file value equals "none", use an empty file. 'none') denylistFile="$(mktempFile)"; true > "${denylistFile:?}" ;; # If the file value equals "builtin", use the built-in value. - 'builtin') denylistFile="$(mktempFile)"; printf -- '%s' "${HBLOCK_DENYLIST_BUILTIN?}" > "${denylistFile:?}" ;; + 'builtin') denylistFile="$(mktempFile)"; printf '%s' "${HBLOCK_DENYLIST_BUILTIN?}" > "${denylistFile:?}" ;; # If the file does not exist, throw an error. *) [ -e "${denylistFile:?}" ] || { printError "No such file: ${denylistFile:?}"; exit 1; } ;; esac @@ -658,23 +658,23 @@ main() { # If the header file is not empty, it is appended to the output file. if [ -s "${headerFile:?}" ]; then - [ -z "${C?}" ] || printf -- '\n%s\n' "${C?} BEGIN HEADER" + [ -z "${C?}" ] || printf '\n%s\n' "${C?} BEGIN HEADER" awk 1 < "${headerFile:?}" - [ -z "${C?}" ] || printf -- '%s\n' "${C?} END HEADER" + [ -z "${C?}" ] || printf '%s\n' "${C?} END HEADER" fi # If the blocklist file is not empty, it is appended to the output file. if [ -s "${blocklistFile:?}" ]; then - [ -z "${C?}" ] || printf -- '\n%s\n' "${C?} BEGIN BLOCKLIST" + [ -z "${C?}" ] || printf '\n%s\n' "${C?} BEGIN BLOCKLIST" awk 1 < "${blocklistFile:?}" - [ -z "${C?}" ] || printf -- '%s\n' "${C?} END BLOCKLIST" + [ -z "${C?}" ] || printf '%s\n' "${C?} END BLOCKLIST" fi # If the footer file is not empty, it is appended to the output file. if [ -s "${footerFile:?}" ]; then - [ -z "${C?}" ] || printf -- '\n%s\n' "${C?} BEGIN FOOTER" + [ -z "${C?}" ] || printf '\n%s\n' "${C?} BEGIN FOOTER" awk 1 < "${footerFile:?}" - [ -z "${C?}" ] || printf -- '%s\n' "${C?} END FOOTER" + [ -z "${C?}" ] || printf '%s\n' "${C?} END FOOTER" fi } diff --git a/resources/index/index.sh b/resources/index/index.sh index c991ac8..68e5e4c 100755 --- a/resources/index/index.sh +++ b/resources/index/index.sh @@ -43,7 +43,7 @@ sha256Checksum() { # Escape string for use in HTML. escapeHTML() { - printf -- '%s' "${1?}" | awk -v RS='' "$(cat <<-'EOF' + printf '%s' "${1?}" | awk -v RS='' "$(cat <<-'EOF' { gsub(/&/, "\\&") gsub(/&2 + printf '%s\n' "Cannot read directory: '${directory:?}'" >&2 exit 1 fi @@ -136,7 +136,7 @@ main() { fileDate="$(getFileModificationTime "${file:?}")" escapedFileDate="$(escapeHTML "${fileDate:?}")" - printf -- '%s\n' "$(cat <<-EOF + printf '%s\n' "$(cat <<-EOF
${escapedFileName:?}
${escapedFileSize:?}
@@ -345,7 +345,7 @@ main() { )" # HTML. - printf -- '%s\n' "$(tr -d '\n' <<-EOF + printf '%s\n' "$(tr -d '\n' <<-EOF diff --git a/resources/packaging/apkbuild/APKBUILD.m4 b/resources/packaging/apkbuild/APKBUILD.m4 index d47d2d9..23f791a 100644 --- a/resources/packaging/apkbuild/APKBUILD.m4 +++ b/resources/packaging/apkbuild/APKBUILD.m4 @@ -1,6 +1,6 @@ # Maintainer: Héctor Molinero Fernández pkgname='hblock' -pkgver='m4_esyscmd(printf -- '%s' "${PKG_VERSION?}")' +pkgver='m4_esyscmd(printf '%s' "${PKG_VERSION?}")' pkgrel='0' pkgdesc='Adblocker that creates a hosts file from multiple sources' url='https://github.com/hectorm/hblock' diff --git a/resources/packaging/deb/debian/changelog.m4 b/resources/packaging/deb/debian/changelog.m4 index 0bc542b..941fe7b 100644 --- a/resources/packaging/deb/debian/changelog.m4 +++ b/resources/packaging/deb/debian/changelog.m4 @@ -1,6 +1,6 @@ m4_changequote([[, ]])m4_dnl -hblock (m4_esyscmd(printf -- '%s' "${PKG_VERSION?}")) unstable; urgency=medium +hblock (m4_esyscmd(printf '%s' "${PKG_VERSION?}")) unstable; urgency=medium - * m4_esyscmd(printf -- '%s' "${PKG_VERSION?}") release. + * m4_esyscmd(printf '%s' "${PKG_VERSION?}") release. -- Héctor Molinero Fernández m4_esyscmd(date -Ru) diff --git a/resources/packaging/npm/package.json.m4 b/resources/packaging/npm/package.json.m4 index de0b5ec..55ad036 100644 --- a/resources/packaging/npm/package.json.m4 +++ b/resources/packaging/npm/package.json.m4 @@ -1,7 +1,7 @@ m4_changequote([[, ]])m4_dnl { "name": "hblock", - "version": "m4_esyscmd(printf -- '%s' "${PKG_VERSION?}")", + "version": "m4_esyscmd(printf '%s' "${PKG_VERSION?}")", "description": "Adblocker that creates a hosts file from multiple sources", "keywords": [ "ad-block", diff --git a/resources/packaging/pkgbuild/PKGBUILD.m4 b/resources/packaging/pkgbuild/PKGBUILD.m4 index e321929..0d93fc6 100644 --- a/resources/packaging/pkgbuild/PKGBUILD.m4 +++ b/resources/packaging/pkgbuild/PKGBUILD.m4 @@ -1,6 +1,6 @@ # Maintainer: Héctor Molinero Fernández pkgname='hblock' -pkgver='m4_esyscmd(printf -- '%s' "${PKG_VERSION?}")' +pkgver='m4_esyscmd(printf '%s' "${PKG_VERSION?}")' pkgrel='1' pkgdesc='Adblocker that creates a hosts file from multiple sources' arch=('any') diff --git a/resources/packaging/rpm/SPECS/hblock.spec.m4 b/resources/packaging/rpm/SPECS/hblock.spec.m4 index 529973b..a34f52d 100644 --- a/resources/packaging/rpm/SPECS/hblock.spec.m4 +++ b/resources/packaging/rpm/SPECS/hblock.spec.m4 @@ -1,6 +1,6 @@ m4_changequote([[, ]])m4_dnl %define name hblock -%define version m4_esyscmd(printf -- '%s' "${PKG_VERSION?}") +%define version m4_esyscmd(printf '%s' "${PKG_VERSION?}") Name: %{name} Version: %{version} diff --git a/resources/stats/stats.sh b/resources/stats/stats.sh index 9e650fa..3bb6477 100755 --- a/resources/stats/stats.sh +++ b/resources/stats/stats.sh @@ -31,7 +31,7 @@ rand() { mktempFile() { # POSIX does not specify the mktemp utility, so here comes a hacky solution. while file="${TMPDIR:-${TMP:-/tmp}}/hblock.${$}.$(rand)" && [ -e "${file:?}" ]; do sleep 1; done - (umask 077 && touch -- "${file:?}"); printf -- '%s' "${file:?}" + (umask 077 && touch -- "${file:?}"); printf '%s' "${file:?}" } # Write stdin to a file. @@ -69,7 +69,7 @@ main() { pslUrl="${2:-https://publicsuffix.org/list/public_suffix_list.dat}" if [ ! -e "${domainsFile:?}" ]; then - printf -- '%s\n' "No such file: '${domainsFile:?}'" >&2 + printf '%s\n' "No such file: '${domainsFile:?}'" >&2 exit 1 fi @@ -102,7 +102,7 @@ main() { while IFS= read -r suffix || [ -n "${suffix?}" ]; do if grep -- "${suffix:?}" "${workFile:?}" > "${matchFile:?}"; then count="$(awk '{N+=$1}END{print(N)}' < "${matchFile:?}")" - printf -- '%s\t%s\n' "${count:?}" "${suffix:?}" >> "${statsFile:?}" + printf '%s\t%s\n' "${count:?}" "${suffix:?}" >> "${statsFile:?}" { grep -v -- "${suffix:?}" "${workFile:?}" ||:; } | sponge "${workFile:?}" fi done < "${pslFile:?}" diff --git a/resources/tests/env.sh b/resources/tests/env.sh index 509ebae..dc077fc 100644 --- a/resources/tests/env.sh +++ b/resources/tests/env.sh @@ -21,9 +21,9 @@ runInTestShell() { assertEquals() { actual="${1?}"; expected="${2?}" if [ "${actual?}" != "${expected?}" ]; then - printf -- '\nError, values are not equal\n\n' >&2 - printf -- '[Actual]:\n\n%s\n\n' "${actual?}" >&2 - printf -- '[Expected]:\n\n%s\n\n' "${expected?}" >&2 + printf '\nError, values are not equal\n\n' >&2 + printf '[Actual]:\n\n%s\n\n' "${actual?}" >&2 + printf '[Expected]:\n\n%s\n\n' "${expected?}" >&2 return 1 fi return 0 diff --git a/resources/tests/test-main-argument-double-dash-arg.sh b/resources/tests/test-main-argument-double-dash-arg.sh index f01dea8..5280c6e 100755 --- a/resources/tests/test-main-argument-double-dash-arg.sh +++ b/resources/tests/test-main-argument-double-dash-arg.sh @@ -15,7 +15,7 @@ SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)" main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" - printf -- 'Test - Main - Argument: Double dash argument\n' + printf 'Test - Main - Argument: Double dash argument\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -- -v)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-argument-invalid-long-opt.sh b/resources/tests/test-main-argument-invalid-long-opt.sh index 59d34b0..ac3b854 100755 --- a/resources/tests/test-main-argument-invalid-long-opt.sh +++ b/resources/tests/test-main-argument-invalid-long-opt.sh @@ -15,7 +15,7 @@ SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)" main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" - printf -- 'Test - Main - Argument: Invalid long option\n' + printf 'Test - Main - Argument: Invalid long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --invalid='VALUE')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-argument-invalid-short-opt.sh b/resources/tests/test-main-argument-invalid-short-opt.sh index aba225d..a549aa6 100755 --- a/resources/tests/test-main-argument-invalid-short-opt.sh +++ b/resources/tests/test-main-argument-invalid-short-opt.sh @@ -15,7 +15,7 @@ SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)" main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" - printf -- 'Test - Main - Argument: Invalid short option\n' + printf 'Test - Main - Argument: Invalid short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -i 'VALUE')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-allowlist.sh b/resources/tests/test-main-feature-allowlist.sh index fa72a3f..acb9df9 100755 --- a/resources/tests/test-main-feature-allowlist.sh +++ b/resources/tests/test-main-feature-allowlist.sh @@ -16,63 +16,63 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_ALLOWLIST_FILE='' - printf -- 'Test - Main - Allowlist: "-A" short option\n' + printf 'Test - Main - Allowlist: "-A" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -A "${SCRIPT_DIR:?}/allowlist.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "--allowlist" long option\n' + printf 'Test - Main - Allowlist: "--allowlist" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --allowlist="${SCRIPT_DIR:?}/allowlist.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "--allowlist" long option with "builtin" value\n' + printf 'Test - Main - Allowlist: "--allowlist" long option with "builtin" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --allowlist='builtin')" expected="$(cat -- "${0%.sh}"-builtin.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "--allowlist" long option with "none" value\n' + printf 'Test - Main - Allowlist: "--allowlist" long option with "none" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --allowlist='none')" expected="$(cat -- "${0%.sh}"-none.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "--allowlist" long option with "-" value\n' + printf 'Test - Main - Allowlist: "--allowlist" long option with "-" value\n' actual="$(cat -- "${SCRIPT_DIR:?}/allowlist.txt" | runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --allowlist='-')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "--allowlist" long option with a non-existent file\n' + printf 'Test - Main - Allowlist: "--allowlist" long option with a non-existent file\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --allowlist='/hblock/invalid.txt')" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "HBLOCK_ALLOWLIST_FILE" environment variable\n' + printf 'Test - Main - Allowlist: "HBLOCK_ALLOWLIST_FILE" environment variable\n' actual="$(set -a; HBLOCK_ALLOWLIST_FILE="${SCRIPT_DIR:?}/allowlist.txt" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "HBLOCK_ALLOWLIST_FILE" environment variable with a non-existent file\n' + printf 'Test - Main - Allowlist: "HBLOCK_ALLOWLIST_FILE" environment variable with a non-existent file\n' actual="$(set -a; HBLOCK_ALLOWLIST_FILE='/hblock/invalid.txt' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Allowlist: "HBLOCK_ALLOWLIST" environment variable\n' + printf 'Test - Main - Allowlist: "HBLOCK_ALLOWLIST" environment variable\n' actual="$(set -a; HBLOCK_ALLOWLIST="$(cat -- "${SCRIPT_DIR:?}/allowlist.txt")" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-comment.sh b/resources/tests/test-main-feature-comment.sh index 7c000ab..542f6d0 100755 --- a/resources/tests/test-main-feature-comment.sh +++ b/resources/tests/test-main-feature-comment.sh @@ -16,21 +16,21 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_COMMENT='#' - printf -- 'Test - Main - Comment: "-C" short option\n' + printf 'Test - Main - Comment: "-C" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -C '# %')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Comment: "--comment" long option\n' + printf 'Test - Main - Comment: "--comment" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --comment='# %')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Comment: "HBLOCK_COMMENT" environment variable\n' + printf 'Test - Main - Comment: "HBLOCK_COMMENT" environment variable\n' actual="$(set -a; HBLOCK_COMMENT='# %' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-denylist.sh b/resources/tests/test-main-feature-denylist.sh index 0dfefa3..d9a0d46 100755 --- a/resources/tests/test-main-feature-denylist.sh +++ b/resources/tests/test-main-feature-denylist.sh @@ -16,63 +16,63 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_DENYLIST_FILE='' - printf -- 'Test - Main - Denylist: "-D" short option\n' + printf 'Test - Main - Denylist: "-D" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -D "${SCRIPT_DIR:?}/denylist.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "--denylist" long option\n' + printf 'Test - Main - Denylist: "--denylist" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --denylist="${SCRIPT_DIR:?}/denylist.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "--denylist" long option with "builtin" value\n' + printf 'Test - Main - Denylist: "--denylist" long option with "builtin" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --denylist='builtin')" expected="$(cat -- "${0%.sh}"-builtin.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "--denylist" long option with "none" value\n' + printf 'Test - Main - Denylist: "--denylist" long option with "none" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --denylist='none')" expected="$(cat -- "${0%.sh}"-none.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "--denylist" long option with "-" value\n' + printf 'Test - Main - Denylist: "--denylist" long option with "-" value\n' actual="$(cat -- "${SCRIPT_DIR:?}/denylist.txt" | runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --denylist='-')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "--denylist" long option with a non-existent file\n' + printf 'Test - Main - Denylist: "--denylist" long option with a non-existent file\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --denylist='/hblock/invalid.txt')" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "HBLOCK_DENYLIST_FILE" environment variable\n' + printf 'Test - Main - Denylist: "HBLOCK_DENYLIST_FILE" environment variable\n' actual="$(set -a; HBLOCK_DENYLIST_FILE="${SCRIPT_DIR:?}/denylist.txt" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "HBLOCK_DENYLIST_FILE" environment variable with a non-existent file\n' + printf 'Test - Main - Denylist: "HBLOCK_DENYLIST_FILE" environment variable with a non-existent file\n' actual="$(set -a; HBLOCK_DENYLIST_FILE='/hblock/invalid.txt' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Denylist: "HBLOCK_DENYLIST" environment variable\n' + printf 'Test - Main - Denylist: "HBLOCK_DENYLIST" environment variable\n' actual="$(set -a; HBLOCK_DENYLIST="$(cat -- "${SCRIPT_DIR:?}/denylist.txt")" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-filter-subdomains.sh b/resources/tests/test-main-feature-filter-subdomains.sh index aace31f..905803f 100755 --- a/resources/tests/test-main-feature-filter-subdomains.sh +++ b/resources/tests/test-main-feature-filter-subdomains.sh @@ -16,21 +16,21 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_FILTER_SUBDOMAINS='false' - printf -- 'Test - Main - Filter subdomains: "-f" short option\n' + printf 'Test - Main - Filter subdomains: "-f" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -f)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Filter subdomains: "--filter-subdomains" long option\n' + printf 'Test - Main - Filter subdomains: "--filter-subdomains" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --filter-subdomains)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Filter subdomains: "HBLOCK_FILTER_SUBDOMAINS" environment variable\n' + printf 'Test - Main - Filter subdomains: "HBLOCK_FILTER_SUBDOMAINS" environment variable\n' actual="$(set -a; HBLOCK_FILTER_SUBDOMAINS='true' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then @@ -39,7 +39,7 @@ main() { export HBLOCK_FILTER_SUBDOMAINS='true' - printf -- 'Test - Main - Filter subdomains: "--no-filter-subdomains" long option\n' + printf 'Test - Main - Filter subdomains: "--no-filter-subdomains" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --no-filter-subdomains)" expected="$(cat -- "${0%.sh}"-false.out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-footer.sh b/resources/tests/test-main-feature-footer.sh index 0b5199e..92bc91a 100755 --- a/resources/tests/test-main-feature-footer.sh +++ b/resources/tests/test-main-feature-footer.sh @@ -16,63 +16,63 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_FOOTER_FILE='' - printf -- 'Test - Main - Footer: "-F" short option\n' + printf 'Test - Main - Footer: "-F" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -F "${SCRIPT_DIR:?}/footer.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "--footer" long option\n' + printf 'Test - Main - Footer: "--footer" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --footer="${SCRIPT_DIR:?}/footer.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "--footer" long option with "builtin" value\n' + printf 'Test - Main - Footer: "--footer" long option with "builtin" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --footer='builtin')" expected="$(cat -- "${0%.sh}"-builtin.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "--footer" long option with "none" value\n' + printf 'Test - Main - Footer: "--footer" long option with "none" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --footer='none')" expected="$(cat -- "${0%.sh}"-none.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "--footer" long option with "-" value\n' + printf 'Test - Main - Footer: "--footer" long option with "-" value\n' actual="$(cat -- "${SCRIPT_DIR:?}/footer.txt" | runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --footer='-')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "--footer" long option with a non-existent file\n' + printf 'Test - Main - Footer: "--footer" long option with a non-existent file\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --footer='/hblock/invalid.txt')" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "HBLOCK_FOOTER_FILE" environment variable\n' + printf 'Test - Main - Footer: "HBLOCK_FOOTER_FILE" environment variable\n' actual="$(set -a; HBLOCK_FOOTER_FILE="${SCRIPT_DIR:?}/footer.txt" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "HBLOCK_FOOTER_FILE" environment variable with a non-existent file\n' + printf 'Test - Main - Footer: "HBLOCK_FOOTER_FILE" environment variable with a non-existent file\n' actual="$(set -a; HBLOCK_FOOTER_FILE='/hblock/invalid.txt' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Footer: "HBLOCK_FOOTER" environment variable\n' + printf 'Test - Main - Footer: "HBLOCK_FOOTER" environment variable\n' actual="$(set -a; HBLOCK_FOOTER="$(cat -- "${SCRIPT_DIR:?}/footer.txt")" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-header.sh b/resources/tests/test-main-feature-header.sh index cc42110..a1b02ff 100755 --- a/resources/tests/test-main-feature-header.sh +++ b/resources/tests/test-main-feature-header.sh @@ -16,63 +16,63 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_HEADER_FILE='' - printf -- 'Test - Main - Header: "-H" short option\n' + printf 'Test - Main - Header: "-H" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -H "${SCRIPT_DIR:?}/header.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "--header" long option\n' + printf 'Test - Main - Header: "--header" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --header="${SCRIPT_DIR:?}/header.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "--header" long option with "builtin" value\n' + printf 'Test - Main - Header: "--header" long option with "builtin" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --header='builtin')" expected="$(cat -- "${0%.sh}"-builtin.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "--header" long option with "none" value\n' + printf 'Test - Main - Header: "--header" long option with "none" value\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --header='none')" expected="$(cat -- "${0%.sh}"-none.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "--header" long option with "-" value\n' + printf 'Test - Main - Header: "--header" long option with "-" value\n' actual="$(cat -- "${SCRIPT_DIR:?}/header.txt" | runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --header='-')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "--header" long option with a non-existent file\n' + printf 'Test - Main - Header: "--header" long option with a non-existent file\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --header='/hblock/invalid.txt')" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "HBLOCK_HEADER_FILE" environment variable\n' + printf 'Test - Main - Header: "HBLOCK_HEADER_FILE" environment variable\n' actual="$(set -a; HBLOCK_HEADER_FILE="${SCRIPT_DIR:?}/header.txt" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "HBLOCK_HEADER_FILE" environment variable with a non-existent file\n' + printf 'Test - Main - Header: "HBLOCK_HEADER_FILE" environment variable with a non-existent file\n' actual="$(set -a; HBLOCK_HEADER_FILE='/hblock/invalid.txt' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-invalid.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Header: "HBLOCK_HEADER" environment variable\n' + printf 'Test - Main - Header: "HBLOCK_HEADER" environment variable\n' actual="$(set -a; HBLOCK_HEADER="$(cat -- "${SCRIPT_DIR:?}/header.txt")" runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-lenient.sh b/resources/tests/test-main-feature-lenient.sh index e9889be..d356f26 100755 --- a/resources/tests/test-main-feature-lenient.sh +++ b/resources/tests/test-main-feature-lenient.sh @@ -16,21 +16,21 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_LENIENT='false' - printf -- 'Test - Main - Lenient: "-l" short option\n' + printf 'Test - Main - Lenient: "-l" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -l)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Lenient: "--lenient" long option\n' + printf 'Test - Main - Lenient: "--lenient" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --lenient)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Lenient: "HBLOCK_LENIENT" environment variable\n' + printf 'Test - Main - Lenient: "HBLOCK_LENIENT" environment variable\n' actual="$(set -a; HBLOCK_LENIENT='true' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then @@ -39,7 +39,7 @@ main() { export HBLOCK_LENIENT='true' - printf -- 'Test - Main - Lenient: "--no-lenient" long option\n' + printf 'Test - Main - Lenient: "--no-lenient" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --no-lenient)" expected="$(cat -- "${0%.sh}"-false.out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-redirection.sh b/resources/tests/test-main-feature-redirection.sh index 7f0c7ad..e55f073 100755 --- a/resources/tests/test-main-feature-redirection.sh +++ b/resources/tests/test-main-feature-redirection.sh @@ -16,21 +16,21 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_REDIRECTION='0.0.0.0' - printf -- 'Test - Main - Redirection: "-R" short option\n' + printf 'Test - Main - Redirection: "-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: "--redirection" long option\n' + printf 'Test - Main - Redirection: "--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 - printf -- 'Test - Main - Redirection: "HBLOCK_REDIRECTION" environment variable\n' + printf 'Test - Main - Redirection: "HBLOCK_REDIRECTION" environment variable\n' actual="$(set -a; HBLOCK_REDIRECTION='::1' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-regex.sh b/resources/tests/test-main-feature-regex.sh index 485f54e..23a3922 100755 --- a/resources/tests/test-main-feature-regex.sh +++ b/resources/tests/test-main-feature-regex.sh @@ -22,21 +22,21 @@ main() { EOF )" - printf -- 'Test - Main - Regex: "-r" short option\n' + printf 'Test - Main - Regex: "-r" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -r)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Regex: "--regex" long option\n' + printf 'Test - Main - Regex: "--regex" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --regex)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Regex: "HBLOCK_REGEX" environment variable\n' + printf 'Test - Main - Regex: "HBLOCK_REGEX" environment variable\n' actual="$(set -a; HBLOCK_REGEX='true' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}"-true.out)" if ! assertEquals "${actual?}" "${expected?}"; then @@ -52,7 +52,7 @@ main() { EOF )" - printf -- 'Test - Main - Regex: "--no-regex" long option\n' + printf 'Test - Main - Regex: "--no-regex" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --no-regex)" expected="$(cat -- "${0%.sh}"-false.out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-template.sh b/resources/tests/test-main-feature-template.sh index 2505197..1874dc0 100755 --- a/resources/tests/test-main-feature-template.sh +++ b/resources/tests/test-main-feature-template.sh @@ -16,21 +16,21 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_TEMPLATE='%R %D' - printf -- 'Test - Main - Template: "-T" short option\n' + printf 'Test - Main - Template: "-T" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -T '%D\n\t└─ %R')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Template: "--template" long option\n' + printf 'Test - Main - Template: "--template" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --template='%D\n\t└─ %R')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Template: "HBLOCK_TEMPLATE" environment variable\n' + printf 'Test - Main - Template: "HBLOCK_TEMPLATE" environment variable\n' actual="$(set -a; HBLOCK_TEMPLATE='%D\n\t└─ %R' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-main-feature-wrap.sh b/resources/tests/test-main-feature-wrap.sh index 833a336..fa44d67 100755 --- a/resources/tests/test-main-feature-wrap.sh +++ b/resources/tests/test-main-feature-wrap.sh @@ -16,21 +16,21 @@ main() { export HBLOCK_SOURCES="file://${SCRIPT_DIR:?}/test-domains-source.txt" export HBLOCK_WRAP='1' - printf -- 'Test - Main - Wrap: "-W" short option\n' + printf 'Test - Main - Wrap: "-W" short option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- -W '5')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Wrap: "--wrap" long option\n' + printf 'Test - Main - Wrap: "--wrap" long option\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO- --wrap='5')" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then exit 1 fi - printf -- 'Test - Main - Wrap: "HBLOCK_WRAP" environment variable\n' + printf 'Test - Main - Wrap: "HBLOCK_WRAP" environment variable\n' actual="$(set -a; HBLOCK_WRAP='5' runInTestShell "${SCRIPT_DIR:?}/../../hblock" -qO-)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-stats-suffixes.sh b/resources/tests/test-stats-suffixes.sh index b8c4853..a477f77 100755 --- a/resources/tests/test-stats-suffixes.sh +++ b/resources/tests/test-stats-suffixes.sh @@ -13,7 +13,7 @@ SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)" . "${SCRIPT_DIR:?}"/env.sh main() { - printf -- 'Test - Stats: Suffixes\n' + printf 'Test - Stats: Suffixes\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../stats/stats.sh" "${SCRIPT_DIR:?}/test-domains-stats.txt" "file://${SCRIPT_DIR:?}/psl.txt")" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/tests/test-stats-tlds.sh b/resources/tests/test-stats-tlds.sh index 8412baa..ef8b3ff 100755 --- a/resources/tests/test-stats-tlds.sh +++ b/resources/tests/test-stats-tlds.sh @@ -13,7 +13,7 @@ SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)" . "${SCRIPT_DIR:?}"/env.sh main() { - printf -- 'Test - Stats: TLDs\n' + printf 'Test - Stats: TLDs\n' actual="$(runInTestShell "${SCRIPT_DIR:?}/../stats/stats.sh" "${SCRIPT_DIR:?}/test-domains-stats.txt" none)" expected="$(cat -- "${0%.sh}".out)" if ! assertEquals "${actual?}" "${expected?}"; then diff --git a/resources/version/version.sh b/resources/version/version.sh index 23e0023..6c3da15 100755 --- a/resources/version/version.sh +++ b/resources/version/version.sh @@ -72,7 +72,7 @@ setVersion() { make -C "${PROJECT_DIR:?}" man # Regenerate checksum file. - printf -- '%s %s\n' "${hblockScriptChecksum:?}" 'hblock' > "${PROJECT_DIR:?}"/hblock.sha256 + printf '%s %s\n' "${hblockScriptChecksum:?}" 'hblock' > "${PROJECT_DIR:?}"/hblock.sha256 } if [ "${1:?}" = 'get' ]; then