logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: b413fa26a34b0aed147568d9f96fcce4186ef0f9
parent ace63eef93afa5c82823fb903b3839440aa9e7d9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 11 Feb 2022 20:03:19 +0100

test-bin/cat: Fix noperm, add enoent

Diffstat:

Mtest-bin/cat14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test-bin/cat b/test-bin/cat @@ -29,10 +29,16 @@ nulldashinput_body() { atf_check ../bin/cat - </dev/null } -atf_test_case noperm +atf_test_case noperm cleanup noperm_body() { + touch inputs/chmod_000 || atf_fail "touching chmod_000" + chmod 0000 inputs/chmod_000 || atf_fail "chmod 0000 chmod_000" atf_check -s exit:1 -e 'inline:\nError opening ‘inputs/chmod_000’: Permission denied\n' ../bin/cat inputs/chmod_000 } +noperm_cleanup() { + chmod 0600 inputs/chmod_000 || atf_fail "chmod 0600 chmod_000" + rm inputs/chmod_000 || atf_fail "rm chmod_000" +} atf_test_case devfull devfull_body() { @@ -46,6 +52,11 @@ readslash_body() { atf_check -s exit:1 -e 'inline:\nError reading ‘/’: Is a directory\n' ../bin/cat / } +atf_test_case enoent +enoent_body() { + atf_check -s exit:1 -e 'inline:\nError opening ‘/var/empty/e/no/ent’: No such file or directory\n' ../bin/cat /var/empty/e/no/ent +} + atf_init_test_cases() { cd "$(atf_get_srcdir)" atf_add_test_case allfile @@ -57,4 +68,5 @@ atf_init_test_cases() { atf_add_test_case noperm atf_add_test_case devfull atf_add_test_case readslash + atf_add_test_case enoent }