time: add test_parse_is8601_invalid (#7278)

pull/7286/head
zakuro 2020-12-12 19:00:07 +09:00 committed by GitHub
parent 095327134e
commit df27a2b8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -106,3 +106,23 @@ fn test_parse_iso8601_local() {
assert t.second == 6
assert t.microsecond == 15959
}
fn test_parse_iso8601_invalid() {
formats := [
'',
'2020-06-05X15:38:06.015959Z',
'2020-06-05T15:38:06.015959X',
'2020-06-05T15:38:06.015959+0000',
'2020-06-05T',
'2020-06-05Z',
'2020-06-05+00:00',
'15:38:06',
]
for format in formats {
time.parse_iso8601(format) or {
assert true
continue
}
assert false
}
}