diff --git a/tests/test-validate.c b/tests/test-validate.c index dc24b145..83e2db8b 100644 --- a/tests/test-validate.c +++ b/tests/test-validate.c @@ -260,6 +260,46 @@ test_validator_manyerrors_desktopapp (void) g_assert_false (ret); } +/** + * test_validator_snapshot_release: + * + * Allow snapshot releases to omit a release date. + */ +static void +test_validator_snapshot_release (void) +{ + gboolean ret; + g_autoptr(GList) issues = NULL; + g_autoptr(AsValidator) validator = as_validator_new (); + + const gchar *SAMPLE_XML = "\n" + " org.example.test\n" + " FSFAP\n" + " LGPL-2.1+\n" + " Test\n" + " Another sample unittest\n" + " \n" + " \n" + " \n" + " \n" + "\n"; + + AsVResultCheck expected_results[] = { + { + "developer-info-missing", "", + -1, + AS_ISSUE_SEVERITY_INFO, }, + + { NULL, NULL, 0, AS_ISSUE_SEVERITY_UNKNOWN } + }; + + ret = as_validator_validate_data (validator, SAMPLE_XML); + + issues = as_validator_get_issues (validator); + _astest_check_validate_issues (issues, (AsVResultCheck *) &expected_results); + g_assert_true (ret); +} + /** * test_validator_relationissues: * @@ -435,6 +475,7 @@ main (int argc, char **argv) test_validator_manyerrors_desktopapp); g_test_add_func ("/AppStream/Validate/RelationIssues", test_validator_relationissues); g_test_add_func ("/AppStream/Validate/Overrides", test_validator_overrides); + g_test_add_func ("/AppStream/Validate/Snapshot", test_validator_snapshot_release); ret = g_test_run (); g_free (datadir);