Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/bin/date Update the test a little so that is possible ...



details:   https://anonhg.NetBSD.org/src/rev/368d0a290ef6
branches:  trunk
changeset: 977669:368d0a290ef6
user:      kre <kre%NetBSD.org@localhost>
date:      Fri Oct 30 22:03:35 2020 +0000

description:
Update the test a little so that is possible to pass
(if date fails, because of bad or out of range input
to parsedate, it cannot be expected to output the
expected result).

Remove the atf-expect-fail now that parsedate() should
detect overflows, and fail, causing date to fail, rather
than simply producing bogus results.

diffstat:

 tests/bin/date/t_date.sh |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r b5c3a1e84de5 -r 368d0a290ef6 tests/bin/date/t_date.sh
--- a/tests/bin/date/t_date.sh  Fri Oct 30 22:03:11 2020 +0000
+++ b/tests/bin/date/t_date.sh  Fri Oct 30 22:03:35 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_date.sh,v 1.1 2020/07/03 03:59:18 jruoho Exp $
+# $NetBSD: t_date.sh,v 1.2 2020/10/30 22:03:35 kre Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,7 +34,7 @@
 
 overflow_body() {
 
-       atf_expect_fail "PR lib/46542"
+       ## atf_expect_fail "PR lib/46542"       # no longer true
 
        years="1 10 100 1000 10000 100000 1000000 10000000 \
              100000000 1000000000 10000000000 100000000000"
@@ -42,10 +42,10 @@
        for year in $years; do
 
                y=$(date +%Y)
-               yy=$(expr $y + $year)
-               yyy=$(date -d "$year years" +%Y)
+               yy=$((y + year))
+               yyy=$(date -d "$year years" +%Y) || continue
 
-               if [ ! $yy -eq $yyy ]; then
+               if [ "$yy" -ne "$yyy" ]; then
                        atf_fail "$yy vs. $yyy"
                fi
        done



Home | Main Index | Thread Index | Old Index