logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: 1eecb504bfccb6ac1340206829d78338935280b0
parent f1473139472b77885d17792cb588d6cb56bd63e7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 15 Feb 2022 02:41:18 +0100

test-bin/date: Add RFC3339 format test

Diffstat:

Mtest-bin/date17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/test-bin/date b/test-bin/date @@ -9,8 +9,21 @@ epoch_body() { atf_check -o "match:^[0-9]+$" ../bin/date '+%s' } +atf_test_case rfc3339 +rfc3339_body() { + atf_check -o "match:^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\+[0-9]{4}$" ../bin/date '+%FT%T%z' +} + + atf_test_case devfull devfull_body() { + if test -f /usr/include/features.h && grep -q '#define\W__GLIBC__' /usr/include/features.h + then + atf_expect_fail "glibc ignoring write errors for puts()" + fi + [ "$(uname -s)" = "NetBSD" ] && atf_expect_fail "NetBSD ignoring write errors for puts()" + [ "$(uname -s)" = "FreeBSD" ] && atf_expect_fail "FreeBSD ignoring write errors for puts()" + atf_check -s exit:1 -e 'inline:puts: No space left on device\n' sh -c '../bin/date >/dev/full' } @@ -23,8 +36,8 @@ atf_init_test_cases() { cd "$(atf_get_srcdir)" || exit 1 atf_add_test_case noargs atf_add_test_case epoch + atf_add_test_case rfc3339 atf_add_test_case utc - # glibc - #atf_add_test_case devfull + atf_add_test_case devfull }