diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/date/date.c | 7 | ||||
| -rw-r--r-- | tests/refs/revparse.c | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/date/date.c b/tests/date/date.c index 88881d1e1..ae787c0d3 100644 --- a/tests/date/date.c +++ b/tests/date/date.c @@ -13,3 +13,10 @@ void test_date_date__overflow(void) cl_assert(d2038 < d2039); #endif } + +void test_date_date__invalid_date(void) +{ + git_time_t d; + cl_git_fail(git__date_parse(&d, "")); + cl_git_fail(git__date_parse(&d, "NEITHER_INTEGER_NOR_DATETIME")); +} diff --git a/tests/refs/revparse.c b/tests/refs/revparse.c index d6ec802e8..8d3a7e057 100644 --- a/tests/refs/revparse.c +++ b/tests/refs/revparse.c @@ -460,6 +460,19 @@ void test_refs_revparse__date(void) test_object("with-empty-log@{2 days ago}", NULL); } +void test_refs_revparse__invalid_date(void) +{ + /* + * $ git rev-parse HEAD@{} -- + * fatal: bad revision 'HEAD@{}' + * + * $ git rev-parse HEAD@{NEITHER_INTEGER_NOR_DATETIME} -- + * fatal: bad revision 'HEAD@{NEITHER_INTEGER_NOR_DATETIME}' + */ + test_object("HEAD@{}", NULL); + test_object("HEAD@{NEITHER_INTEGER_NOR_DATETIME}", NULL); +} + void test_refs_revparse__colon(void) { assert_invalid_single_spec(":/"); |
