From 2d5db505e70336e56e739d56d8ca358fc6bc4a6a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 17 Aug 2016 09:11:02 +0100 Subject: Test: Add trailing whitespace and garbage datetime string parse tests. --- test/time.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/time.c b/test/time.c index 34cfac0f0..07e59e968 100644 --- a/test/time.c +++ b/test/time.c @@ -212,6 +212,10 @@ static const struct test_string_pair date_string_tests[] = { .test = "20051212 UTC", .expected = "Mon, 12 Dec 2005 00:00:00 GMT" }, + { + .test = "20051212 \n", + .expected = "Mon, 12 Dec 2005 00:00:00 GMT" + }, { .test = "20051212 00:00 UTC", .expected = "Mon, 12 Dec 2005 00:00:00 GMT" @@ -232,6 +236,10 @@ static const struct test_string_pair date_string_tests[] = { .test = "Thu, 11 Aug 2016 08:47:30 GMT", .expected = "Thu, 11 Aug 2016 08:47:30 GMT" }, + { + .test = "Thu, 11 Aug 2016 08:47:30 GMT garbage", + .expected = "Thu, 11 Aug 2016 08:47:30 GMT" + }, { .test = "Thu, 11 Aug 2016 08:47:30 UTC", .expected = "Thu, 11 Aug 2016 08:47:30 GMT" @@ -340,6 +348,10 @@ static const struct test_bad_string date_bad_string_tests[] = { .test = "Foosday, 16 Dec 1977 23:45:12 GMT", .res = NSERROR_INVALID }, + { + .test = "20051212 garbage", + .res = NSERROR_INVALID + }, }; /** -- cgit v1.2.3