Source-Changes-HG archive

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

[src/netbsd-7]: src/tests/lib/libutil Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/e287d8976d81
branches:  netbsd-7
changeset: 798410:e287d8976d81
user:      snj <snj%NetBSD.org@localhost>
date:      Sat Oct 11 16:43:46 2014 +0000

description:
Pull up following revision(s) (requested by apb in ticket #135):
        tests/lib/libutil/t_parsedate.c: revision 1.9
Add comments for some non-obvious cases.
Also add a test with year=70, which is documented to be treated as 1970.

diffstat:

 tests/lib/libutil/t_parsedate.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (43 lines):

diff -r f7f301aa6e0e -r e287d8976d81 tests/lib/libutil/t_parsedate.c
--- a/tests/lib/libutil/t_parsedate.c   Sat Oct 11 16:42:45 2014 +0000
+++ b/tests/lib/libutil/t_parsedate.c   Sat Oct 11 16:43:46 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_parsedate.c,v 1.7.8.1 2014/10/11 16:42:45 snj Exp $ */
+/* $NetBSD: t_parsedate.c,v 1.7.8.2 2014/10/11 16:43:46 snj Exp $ */
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_parsedate.c,v 1.7.8.1 2014/10/11 16:42:45 snj Exp $");
+__RCSID("$NetBSD: t_parsedate.c,v 1.7.8.2 2014/10/11 16:43:46 snj Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -101,11 +101,13 @@
 {
 
        parsecheck("69-09-10", NULL, NULL, localtime_r,
-               2069, 9, 10, 0, 0, 0);
+               2069, 9, 10, 0, 0, 0); /* year < 70: add 2000 */
+       parsecheck("70-09-10", NULL, NULL, localtime_r,
+               1970, 9, 10, 0, 0, 0); /* 70 <= year < 100: add 1900 */
        parsecheck("2006-11-17", NULL, NULL, localtime_r,
                2006, 11, 17, 0, 0, 0);
        parsecheck("10/1/2000", NULL, NULL, localtime_r,
-               2000, 10, 1, 0, 0, 0);
+               2000, 10, 1, 0, 0, 0); /* month/day/year */
        parsecheck("20 Jun 1994", NULL, NULL, localtime_r,
                1994, 6, 20, 0, 0, 0);
        parsecheck("23jun2001", NULL, NULL, localtime_r,
@@ -113,7 +115,7 @@
        parsecheck("1-sep-06", NULL, NULL, localtime_r,
                2006, 9, 1, 0, 0, 0);
        parsecheck("1/11", NULL, NULL, localtime_r,
-               ANY, 1, 11, 0, 0, 0);
+               ANY, 1, 11, 0, 0, 0); /* month/day */
        parsecheck("1500-01-02", NULL, NULL, localtime_r,
                1500, 1, 2, 0, 0, 0);
        parsecheck("9999-12-21", NULL, NULL, localtime_r,



Home | Main Index | Thread Index | Old Index