Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libutil Fix the "Tuesday midnight" test to match w...



details:   https://anonhg.NetBSD.org/src/rev/ea31d6731a93
branches:  trunk
changeset: 812742:ea31d6731a93
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Dec 31 10:10:15 2015 +0000

description:
Fix the "Tuesday midnight" test to match what parsedate.y does; in
particular it doesn't add a week if evaluating that on Wednesday.

Whether that's right is an open question, but there's not exactly a
spec for parsedate.y and there's no point having the test fail one
day in seven.

PR 50574.

diffstat:

 tests/lib/libutil/t_parsedate.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 6116ddcdcc2f -r ea31d6731a93 tests/lib/libutil/t_parsedate.c
--- a/tests/lib/libutil/t_parsedate.c   Thu Dec 31 09:12:57 2015 +0000
+++ b/tests/lib/libutil/t_parsedate.c   Thu Dec 31 10:10:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.16 2015/12/08 12:41:28 christos Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.17 2015/12/31 10:10:15 dholland Exp $ */
 /*-
  * Copyright (c) 2010, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_parsedate.c,v 1.16 2015/12/08 12:41:28 christos Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.17 2015/12/31 10:10:15 dholland Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -380,7 +380,7 @@
        REL_CHECK("midnight Tuesday", now, tm);
 
        ATF_CHECK(localtime_r(&now, &tm) != NULL);
-       if (tm.tm_wday > 2)
+       if (tm.tm_wday > 2 + 1)
                tm.tm_mday += 7;
        tm.tm_mday += 2 - tm.tm_wday;
        tm.tm_mday++;   /* xxx midnight --> the next day */



Home | Main Index | Thread Index | Old Index