[glib/wip/rancell/iso8601] Check strings containing only times fail
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/rancell/iso8601] Check strings containing only times fail
- Date: Mon, 29 Aug 2016 01:01:47 +0000 (UTC)
commit abbc36300bf4f005e0d4cb20926f68e8bae6afb8
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Aug 29 13:01:34 2016 +1200
Check strings containing only times fail
glib/tests/gdatetime.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 27887f2..3fd10e3 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -589,6 +589,21 @@ test_GDateTime_new_from_iso8601 (void)
g_assert_cmpint (flags, ==, G_DATE_TIME_PARSE_HOUR | G_DATE_TIME_PARSE_MINUTE | G_DATE_TIME_PARSE_SECOND |
G_DATE_TIME_PARSE_SUBSECOND);
g_date_time_unref (dt);
+ /* Can't parse time without date */
+ dt = g_date_time_new_from_iso8601 ("22", &flags);
+ g_assert (dt == NULL);
+ dt = g_date_time_new_from_iso8601 ("22:10", &flags);
+ g_assert (dt == NULL);
+ dt = g_date_time_new_from_iso8601 ("22:10:42", &flags);
+ g_assert (dt == NULL);
+ dt = g_date_time_new_from_iso8601 ("22:10:42.123456", &flags);
+ g_assert (dt == NULL);
+ dt = g_date_time_new_from_iso8601 ("2210", &flags);
+ g_assert (dt == NULL);
+ dt = g_date_time_new_from_iso8601 ("221042", &flags);
+ g_assert (dt == NULL);
+ dt = g_date_time_new_from_iso8601 ("221042.123456", &flags);
+
dt = g_date_time_new_from_iso8601 ("2016-08-24T22", &flags);
ASSERT_DATE (dt, 2016, 8, 24);
ASSERT_TIME (dt, 22, 0, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]