From 3a8e66e4f2d24c02c6e3029c04dcb078bd324605 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 24 Jan 2001 00:36:46 +0000 Subject: Added tests to see that invalid match and action rules are properly 2001-01-24 Not Zed * tests/folder/test9.c (main): Added tests to see that invalid match and action rules are properly detected. svn path=/trunk/; revision=7767 --- camel/ChangeLog | 2 ++ camel/tests/folder/test9.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/camel/ChangeLog b/camel/ChangeLog index 99eb32f0b9..8542d1f0d1 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,6 +1,8 @@ 2001-01-24 Not Zed * tests/folder/test9.c (main): Fix for api changes. + (main): Added tests to see that invalid match and action + rules are properly detected. * camel-filter-driver.c (camel_filter_driver_filter_mbox): Remove the 'finished message' bit. diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c index 7e90e99e1e..46d398d6ab 100644 --- a/camel/tests/folder/test9.c +++ b/camel/tests/folder/test9.c @@ -51,6 +51,35 @@ struct { { "count1", "(body-contains \"data3\")", "(move-to \"folder2\")" }, }; +/* broken match rules */ +struct { + char *name, *match, *action; +} brokens[] = { + { "count1", "(body-contains data50)", "(copy-to \"folder1\")" }, /* non string argument */ + { "count1", "(body-contains-stuff \"data3\")", "(move-to-folder \"folder2\")" }, /* invalid function */ + { "count1", "(or (body-contains \"data3\") (foo))", "(move-to-folder \"folder2\")" }, /* invalid function */ + { "count1", "(or (body-contains \"data3\") (foo)", "(move-to-folder \"folder2\")" }, /* missing ) */ + { "count1", "(and body-contains \"data3\") (foo)", "(move-to-folder \"folder2\")" }, /* missing ( */ + { "count1", "body-contains \"data3\")", "(move-to-folder \"folder2\")" }, /* missing ( */ + { "count1", "body-contains \"data3\"", "(move-to-folder \"folder2\")" }, /* missing ( ) */ + { "count1", "(body-contains \"data3\" ())", "(move-to-folder \"folder2\")" }, /* extra () */ + { "count1", "()", "(move-to-folder \"folder2\")" }, /* invalid () */ + { "count1", "", "(move-to-folder \"folder2\")" }, /* empty */ +}; + +/* broken action rules */ +struct { + char *name, *match, *action; +} brokena[] = { + { "a", "(body-contains \"data2\")", "(body-contains \"help\")" }, /* rule in action */ + { "a", "(body-contains \"data2\")", "(move-to-folder-name \"folder2\")" }, /* unknown function */ + { "a", "(body-contains \"data2\")", "(or (move-to-folder \"folder2\")" }, /* missing ) */ + { "a", "(body-contains \"data2\")", "(or move-to-folder \"folder2\"))" }, /* missing ( */ + { "a", "(body-contains \"data2\")", "move-to-folder \"folder2\")" }, /* missing ( */ + { "a", "(body-contains \"data2\")", "(move-to-folder \"folder2\" ())" }, /* invalid () */ + { "a", "(body-contains \"data2\")", "()" }, /* invalid () */ + { "a", "(body-contains \"data2\")", "" }, /* empty */ +}; static CamelFolder *get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelException *ex) { @@ -161,6 +190,34 @@ int main(int argc, char **argv) check_unref(driver, 1); pull(); + /* this tests that invalid rules are caught */ + push("Testing broken match rules"); + for (i=0;i