diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:53:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:53:52 +0000 |
commit | efe47381c599b07e4c7bbdb2e91e8090a541c887 (patch) | |
tree | 05cf57183f5a23394eca11b00f97a74a5dfdf79d /test/test_wrap-and-sort | |
parent | Initial commit. (diff) | |
download | devscripts-upstream.tar.xz devscripts-upstream.zip |
Adding upstream version 2.23.4+deb12u1.upstream/2.23.4+deb12u1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_wrap-and-sort')
-rwxr-xr-x | test/test_wrap-and-sort | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/test_wrap-and-sort b/test/test_wrap-and-sort new file mode 100755 index 0000000..ac6bdab --- /dev/null +++ b/test/test_wrap-and-sort @@ -0,0 +1,50 @@ +#!/bin/sh + +# Copyright (C) 2022, Niels Thykier <niels@thykier.net> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -u + + +WORK_DIR="$(readlink -f "${0%/*}")" +if test "${1:-}" = --installed; then + wrap_and_sort="wrap-and-sort " + shift +else + wrap_and_sort="${WORK_DIR}/../scripts/wrap-and-sort" +fi + +. "${WORK_DIR}/test_helper.sh" + +oneTimeSetUp() { + TEMP_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR" wrap-and-sort.XXXXX) +} + +# Run as `prepare_and_run_wrap_and_sort <test-name> [args-for-wrap-and-sort]` +prepare_and_run_wrap_and_sort() { + TEST_NAME="${1}" + TEST_DIR="${TEMP_DIR}/${TEST_NAME}" + + mkdir "${TEST_DIR}" + cp -a "${WORK_DIR}/wrap-and-sort/${TEST_NAME}/in/"* "$TEST_DIR/" || exit 1 + assertPasses $wrap_and_sort -d "$TEST_DIR" + assertPasses diff -Nuarp "${WORK_DIR}/wrap-and-sort/${TEST_NAME}/out" "${TEST_DIR}" +} + +test_install_comments() { + prepare_and_run_wrap_and_sort 'install-comments' +} + +. shunit2 |