logo

utils-std

Collection of commonly available Unix tools
commit: 8b51136387d07ba35a8e4b951e7d3620e61e5dad
parent 24adb9d1751957d87398a7a3dfa7b225aa9c66a4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 13 Jun 2024 19:44:23 +0200

test-cmd/unlink: Change from ATF to tap.sh

Diffstat:

Mtest-cmd/Kyuafile2+-
Dtest-cmd/unlink24------------------------
Atest-cmd/unlink.sh13+++++++++++++
3 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/test-cmd/Kyuafile b/test-cmd/Kyuafile @@ -17,7 +17,6 @@ atf_test_program{name="strings", required_files=basedir.."/cmd/strings", timeout atf_test_program{name="tee", required_files=basedir.."/cmd/tee", timeout=1} atf_test_program{name="touch", required_files=basedir.."/cmd/touch", timeout=3} atf_test_program{name="tty", required_files=basedir.."/cmd/tty", timeout=1} -atf_test_program{name="unlink", required_files=basedir.."/cmd/unlink", timeout=1} tap_test_program{name="arch.sh", required_files=basedir.."/cmd/arch", timeout=1} tap_test_program{name="basename.sh", required_files=basedir.."/cmd/basename", timeout=1} tap_test_program{name="chmod.sh", required_files=basedir.."/cmd/chmod", timeout=1} @@ -31,3 +30,4 @@ tap_test_program{name="seq.sh", required_files=basedir.."/cmd/seq", timeout=1} tap_test_program{name="test.sh", required_files=basedir.."/cmd/test", timeout=2} tap_test_program{name="true.sh", required_files=basedir.."/cmd/true", timeout=1} tap_test_program{name="uname.sh", required_files=basedir.."/cmd/uname", timeout=1} +tap_test_program{name="unlink.sh", required_files=basedir.."/cmd/unlink", timeout=1} diff --git a/test-cmd/unlink b/test-cmd/unlink @@ -1,24 +0,0 @@ -#!/usr/bin/env atf-sh -# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> -# SPDX-License-Identifier: MPL-2.0 - -atf_test_case basic cleanup -basic_body() { - touch inputs/unlink-this || atf_fail "touch inputs/unlink-this" - atf_check ../cmd/unlink inputs/unlink-this -} -basic_cleanup() { - rm -f inputs/unlink-this || atf_fail "rm -f inputs/unlink-this" -} - -atf_test_case enoent -enoent_body() { - # shellcheck disable=SC1112 - atf_check -s exit:1 -e 'inline:unlink: Cannot unlink ‘/var/empty/e/no/ent’: No such file or directory\n' ../cmd/unlink /var/empty/e/no/ent -} - -atf_init_test_cases() { - cd "$(atf_get_srcdir)" || exit 1 - atf_add_test_case basic - atf_add_test_case enoent -} diff --git a/test-cmd/unlink.sh b/test-cmd/unlink.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> +# SPDX-License-Identifier: MPL-2.0 + +target="$(dirname "$0")/../cmd/unlink" +plans=2 +. "$(dirname "$0")/tap.sh" + +touch unlink-this +t basic 'unlink-this' '' +rm -f unlink-this || exit 1 + +t --exit=1 enoent /var/empty/e/no/ent $'unlink: Cannot unlink ‘/var/empty/e/no/ent’: No such file or directory\n'