Test: Add trailing whitespace and garbage datetime string parse tests.

This commit is contained in:
Michael Drake 2016-08-17 09:11:02 +01:00
parent 30646c3145
commit 2d5db505e7

View File

@ -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
},
};
/**