diff options
author | Jens Georg <mail@jensge.org> | 2010-08-25 00:18:23 +0300 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2010-08-26 18:18:52 +0300 |
commit | db7ddcc19529a101b820347e8cca419fb37f6a02 (patch) | |
tree | 885c5dfd4ba281b4987c527c6671d5a0189ccfeb /tests | |
parent | 9a61fb2c640708070a32c18bd06ae94ee71c925f (diff) |
Improve parsing of date-only iso8601 strings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testglib.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/testglib.c b/tests/testglib.c index 2453e167a..762592858 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -1283,6 +1283,7 @@ various_string_tests (void) #define REF_INVALID1 "Wed Dec 19 17:20:20 GMT 2007" #define REF_INVALID2 "1980-02-22T10:36:00Zulu" +#define REF_INVALID3 "1980-02-22T" #define REF_SEC_UTC 320063760 #define REF_STR_UTC "1980-02-22T10:36:00Z" #define REF_STR_LOCAL "1980-02-22T13:36:00" @@ -1294,6 +1295,7 @@ various_string_tests (void) #define REF_STR_USEC_CEST "19800222T123600.050000000+0200" #define REF_STR_USEC_EST "1980-02-22T05:36:00,05-05:00" #define REF_STR_USEC_NST "19800222T070600,0500-0330" +#define REF_STR_DATE_ONLY "1980-02-22" if (g_test_verbose()) g_print ("checking g_time_val_from_iso8601...\n"); @@ -1301,6 +1303,8 @@ various_string_tests (void) ref_date.tv_usec = 0; g_assert (g_time_val_from_iso8601 (REF_INVALID1, &date) == FALSE); g_assert (g_time_val_from_iso8601 (REF_INVALID2, &date) == FALSE); + g_assert (g_time_val_from_iso8601 (REF_INVALID3, &date) == FALSE); + g_assert (g_time_val_from_iso8601 (REF_STR_DATE_ONLY, &date) != FALSE); g_assert (g_time_val_from_iso8601 (REF_STR_UTC, &date) != FALSE); if (g_test_verbose()) g_print ("\t=> UTC stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n", |