diff --git a/TODO b/TODO index 6a1f322c1c9b94619d75bdb3fe4c49491ec89c13..4a16162f60d92ccc57a5cca279cea33d3dddbbb3 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ Current activities: - Review logging and error handling; add more warning/info/debug messages where useful. * Cleanup the test suite - - Make uniform command implementations - Cleanup test scripts Next (in order of descending priority/precedence): diff --git a/src/testsuite/Makefile.am b/src/testsuite/Makefile.am index a57771cfa0262971815aa030002b08221265c6b9..32fce56063050aba819b0ef11f96651819a1fc8b 100644 --- a/src/testsuite/Makefile.am +++ b/src/testsuite/Makefile.am @@ -20,8 +20,7 @@ commands = \ cmd-test-fail.c \ cmd-test-config.c \ cmd-test-set.c \ - cmd-test-result-reset.c \ - cmd-test-result-print.c \ + cmd-test-result.c \ cmd-test-message.c \ cmd-test-mailbox.c \ cmd-test-binary.c @@ -31,7 +30,7 @@ tests = \ tst-test-script-run.c \ tst-test-multiscript.c \ tst-test-error.c \ - tst-test-result.c \ + tst-test-result-action.c \ tst-test-result-execute.c testsuite_SOURCES = \ diff --git a/src/testsuite/cmd-test-binary.c b/src/testsuite/cmd-test-binary.c index 7c58e76179dcf9514e78a65286df20a4c7de6406..7bb076ca3612ab18c974c775a386df8e4e66dbe7 100644 --- a/src/testsuite/cmd-test-binary.c +++ b/src/testsuite/cmd-test-binary.c @@ -15,25 +15,42 @@ #include "testsuite-script.h" /* - * Test_binary command - * - * Syntax: - * test_binary ( :load / :save ) <mailbox: string> + * Commands */ -static bool cmd_test_binary_registered - (struct sieve_validator *valdtr, const struct sieve_extension *ext, - struct sieve_command_registration *cmd_reg); static bool cmd_test_binary_validate (struct sieve_validator *valdtr, struct sieve_command *cmd); static bool cmd_test_binary_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *ctx); -const struct sieve_command_def cmd_test_binary = { - "test_binary", +/* Test_binary_load command + * + * Syntax: + * test_binary_load <binary-name: string> + */ + +const struct sieve_command_def cmd_test_binary_load = { + "test_binary_load", SCT_COMMAND, 1, 0, FALSE, FALSE, - cmd_test_binary_registered, + NULL, + NULL, + cmd_test_binary_validate, + cmd_test_binary_generate, + NULL +}; + +/* Test_binary_save command + * + * Syntax: + * test_binary_save <binary-name: string> + */ + +const struct sieve_command_def cmd_test_binary_save = { + "test_binary_save", + SCT_COMMAND, + 1, 0, FALSE, FALSE, + NULL, NULL, cmd_test_binary_validate, cmd_test_binary_generate, @@ -69,88 +86,6 @@ const struct sieve_operation_def test_binary_save_operation = { cmd_test_binary_operation_execute }; -/* - * Compiler context data - */ - -enum test_binary_operation { - BINARY_OP_LOAD, - BINARY_OP_SAVE, - BINARY_OP_LAST -}; - -const struct sieve_operation_def *test_binary_operations[] = { - &test_binary_load_operation, - &test_binary_save_operation -}; - -struct cmd_test_binary_context_data { - enum test_binary_operation binary_op; - const char *folder; -}; - -/* - * Command tags - */ - -static bool cmd_test_binary_validate_tag - (struct sieve_validator *valdtr, struct sieve_ast_argument **arg, - struct sieve_command *cmd); - -static const struct sieve_argument_def test_binary_load_tag = { - "load", - NULL, - cmd_test_binary_validate_tag, - NULL, NULL, NULL, -}; - -static const struct sieve_argument_def test_binary_save_tag = { - "save", - NULL, - cmd_test_binary_validate_tag, - NULL, NULL, NULL, -}; - -static bool cmd_test_binary_registered -(struct sieve_validator *valdtr, const struct sieve_extension *ext, - struct sieve_command_registration *cmd_reg) -{ - /* Register our tags */ - sieve_validator_register_tag(valdtr, cmd_reg, ext, &test_binary_load_tag, 0); - sieve_validator_register_tag(valdtr, cmd_reg, ext, &test_binary_save_tag, 0); - - return TRUE; -} - -static bool cmd_test_binary_validate_tag -(struct sieve_validator *valdtr, struct sieve_ast_argument **arg, - struct sieve_command *cmd) -{ - struct cmd_test_binary_context_data *ctx_data = - (struct cmd_test_binary_context_data *) cmd->data; - - if ( ctx_data != NULL ) { - sieve_argument_validate_error - (valdtr, *arg, "exactly one of the ':load' or ':save' tags must be " - "specified for the test_binary command, but more were found"); - return NULL; - } - - ctx_data = p_new - (sieve_command_pool(cmd), struct cmd_test_binary_context_data, 1); - cmd->data = ctx_data; - - if ( sieve_argument_is(*arg, test_binary_load_tag) ) - ctx_data->binary_op = BINARY_OP_LOAD; - else - ctx_data->binary_op = BINARY_OP_SAVE; - - /* Delete this tag */ - *arg = sieve_ast_arguments_detach(*arg, 1); - - return TRUE; -} - /* * Validation */ @@ -159,14 +94,7 @@ static bool cmd_test_binary_validate (struct sieve_validator *valdtr, struct sieve_command *cmd) { struct sieve_ast_argument *arg = cmd->first_positional; - - if ( cmd->data == NULL ) { - sieve_command_validate_error(valdtr, cmd, - "the test_binary command requires either the :load or the :save tag " - "to be specified"); - return FALSE; - } - + if ( !sieve_validate_positional_argument (valdtr, cmd, arg, "binary-name", 1, SAAT_STRING) ) { return FALSE; @@ -182,15 +110,14 @@ static bool cmd_test_binary_validate static bool cmd_test_binary_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) { - struct cmd_test_binary_context_data *ctx_data = - (struct cmd_test_binary_context_data *) cmd->data; - - i_assert( ctx_data->binary_op < BINARY_OP_LAST ); - /* Emit operation */ - sieve_operation_emit(cgenv->sblock, cmd->ext, - test_binary_operations[ctx_data->binary_op]); - + if ( sieve_command_is(cmd, cmd_test_binary_load) ) + sieve_operation_emit(cgenv->sblock, cmd->ext, &test_binary_load_operation); + else if ( sieve_command_is(cmd, cmd_test_binary_save) ) + sieve_operation_emit(cgenv->sblock, cmd->ext, &test_binary_save_operation); + else + i_unreached(); + /* Generate arguments */ if ( !sieve_generate_arguments(cgenv, cmd, NULL) ) return FALSE; @@ -212,7 +139,6 @@ static bool cmd_test_binary_operation_dump return sieve_opr_string_dump(denv, address, "binary-name"); } - /* * Intepretation */ @@ -242,7 +168,7 @@ static int cmd_test_binary_operation_execute struct sieve_binary *sbin = testsuite_binary_load(str_c(binary_name)); if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { - sieve_runtime_trace(renv, 0, "testsuite: test_binary command"); + sieve_runtime_trace(renv, 0, "testsuite: test_binary_load command"); sieve_runtime_trace_descend(renv); sieve_runtime_trace(renv, 0, "load binary `%s'", str_c(binary_name)); } @@ -260,7 +186,7 @@ static int cmd_test_binary_operation_execute struct sieve_binary *sbin = testsuite_script_get_binary(); if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { - sieve_runtime_trace(renv, 0, "testsuite: test_binary command"); + sieve_runtime_trace(renv, 0, "testsuite: test_binary_save command"); sieve_runtime_trace_descend(renv); sieve_runtime_trace(renv, 0, "save binary `%s'", str_c(binary_name)); } diff --git a/src/testsuite/cmd-test-config.c b/src/testsuite/cmd-test-config.c index 8aa47eb7396ccbf42ee42c88ea67a19864af61db..8316cd84ea54c557c5abdd3fe5ac4a1f03bf332e 100644 --- a/src/testsuite/cmd-test-config.c +++ b/src/testsuite/cmd-test-config.c @@ -15,36 +15,101 @@ #include "testsuite-settings.h" /* - * Test_config command - * - * Syntax: - * test_config ( - * :set <setting: string> <value: string> / - * :unset <setting: string> / - * :reload [<extension: string>] ) + * Commands */ -static bool cmd_test_config_registered - (struct sieve_validator *valdtr, const struct sieve_extension *ext, - struct sieve_command_registration *cmd_reg); static bool cmd_test_config_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *ctx); -const struct sieve_command_def cmd_test_config = { - "test_config", +/* Test_config_set command + * + * Syntax: + * test_config_set <setting: string> <value: string> + */ + +static bool cmd_test_config_set_validate + (struct sieve_validator *valdtr, struct sieve_command *cmd); + +const struct sieve_command_def cmd_test_config_set = { + "test_config_set", SCT_COMMAND, - 0, 0, FALSE, FALSE, - cmd_test_config_registered, + 2, 0, FALSE, FALSE, NULL, NULL, + cmd_test_config_set_validate, + cmd_test_config_generate, + NULL +}; + +/* Test_config_unset command + * + * Syntax: + * test_config_unset <setting: string> + */ + +static bool cmd_test_config_unset_validate + (struct sieve_validator *valdtr, struct sieve_command *cmd); + +const struct sieve_command_def cmd_test_config_unset = { + "test_config_unset", + SCT_COMMAND, + 1, 0, FALSE, FALSE, + NULL, NULL, + cmd_test_config_unset_validate, + cmd_test_config_generate, + NULL +}; + +/* Test_config_reload command + * + * Syntax: + * test_config_reload [:extension <extension: string>] + */ + +static bool cmd_test_config_reload_registered +(struct sieve_validator *valdtr, const struct sieve_extension *ext, + struct sieve_command_registration *cmd_reg); + +const struct sieve_command_def cmd_test_config_reload = { + "test_config_reload", + SCT_COMMAND, + 0, 0, FALSE, FALSE, + cmd_test_config_reload_registered, + NULL, NULL, cmd_test_config_generate, NULL }; +/* + * Command tags + */ + +/* Forward declarations */ + +static bool cmd_test_config_reload_validate_tag + (struct sieve_validator *valdtr, struct sieve_ast_argument **arg, + struct sieve_command *cmd); + +/* Argument objects */ + +static const struct sieve_argument_def test_config_reload_extension_tag = { + "extension", + NULL, + cmd_test_config_reload_validate_tag, + NULL, NULL, NULL, +}; + +/* Codes for optional arguments */ + +enum cmd_test_config_optional { + OPT_END, + OPT_EXTENSION +}; + /* * Operations */ -/* Test_message_set operation */ +/* Test_config_set operation */ static bool cmd_test_config_set_operation_dump (const struct sieve_dumptime_env *denv, sieve_size_t *address); @@ -59,7 +124,7 @@ const struct sieve_operation_def test_config_set_operation = { cmd_test_config_set_operation_execute }; -/* Test_message_unset operation */ +/* Test_config_unset operation */ static bool cmd_test_config_unset_operation_dump (const struct sieve_dumptime_env *denv, sieve_size_t *address); @@ -74,7 +139,7 @@ const struct sieve_operation_def test_config_unset_operation = { cmd_test_config_unset_operation_execute }; -/* Test_message_mailbox operation */ +/* Test_config_read operation */ static bool cmd_test_config_reload_operation_dump (const struct sieve_dumptime_env *denv, sieve_size_t *address); @@ -90,172 +155,92 @@ const struct sieve_operation_def test_config_reload_operation = { }; /* - * Compiler context data + * Tag validation */ -enum cmd_test_config_action { - CONFIG_ACTION_SET, - CONFIG_ACTION_UNSET, - CONFIG_ACTION_RELOAD, - CONFIG_ACTION_LAST -}; - -const struct sieve_operation_def *test_config_operations[] = { - &test_config_set_operation, - &test_config_unset_operation, - &test_config_reload_operation -}; - -struct cmd_test_config_data { - enum cmd_test_config_action action; -}; - -/* - * Command tags - */ - -static bool tag_action_is_instance_of - (struct sieve_validator *valdtr, struct sieve_command *cmd, - const struct sieve_extension *ext, const char *identifier, void **data); -static bool tag_action_validate - (struct sieve_validator *valdtr, struct sieve_ast_argument **arg, - struct sieve_command *cmd); -static bool tag_action_generate - (const struct sieve_codegen_env *cgenv, struct sieve_ast_argument *arg, - struct sieve_command *cmd); +static bool cmd_test_config_reload_validate_tag +(struct sieve_validator *valdtr, struct sieve_ast_argument **arg, + struct sieve_command *cmd) +{ + struct sieve_ast_argument *tag = *arg; -static const struct sieve_argument_def config_action_tag = { - "CONFIG_ACTION", - tag_action_is_instance_of, - tag_action_validate, - NULL, NULL, - tag_action_generate -}; + /* Detach the tag itself */ + *arg = sieve_ast_arguments_detach(*arg,1); -static bool tag_action_is_instance_of -(struct sieve_validator *valdtr ATTR_UNUSED, struct sieve_command *cmd, - const struct sieve_extension *ext ATTR_UNUSED, const char *identifier, - void **data) -{ - enum cmd_test_config_action action = CONFIG_ACTION_LAST; - struct cmd_test_config_data *ctx_data; - - if ( strcmp(identifier, "set") == 0 ) - action = CONFIG_ACTION_SET; - else if ( strcmp(identifier, "unset") == 0 ) - action = CONFIG_ACTION_UNSET; - else if ( strcmp(identifier, "reload") == 0 ) - action = CONFIG_ACTION_RELOAD; - else + /* Check syntax: + * :extension <extension: string> + */ + if ( !sieve_validate_tag_parameter + (valdtr, cmd, tag, *arg, NULL, 0, SAAT_STRING, TRUE) ) { return FALSE; + } - if ( data != NULL ) { - ctx_data = p_new - (sieve_command_pool(cmd), struct cmd_test_config_data, 1); - ctx_data->action = action; - *data = (void *) ctx_data; - } - + /* Skip parameter */ + *arg = sieve_ast_argument_next(*arg); + return TRUE; } -static bool cmd_test_config_registered +/* + * Command registration + */ + +static bool cmd_test_config_reload_registered (struct sieve_validator *valdtr, const struct sieve_extension *ext, struct sieve_command_registration *cmd_reg) { - /* Register our tags */ sieve_validator_register_tag - (valdtr, cmd_reg, ext, &config_action_tag, 0); + (valdtr, cmd_reg, ext, &test_config_reload_extension_tag, OPT_EXTENSION); return TRUE; } -static bool tag_action_validate -(struct sieve_validator *valdtr, struct sieve_ast_argument **arg, - struct sieve_command *cmd) +/* + * Command validation + */ + +static bool cmd_test_config_set_validate +(struct sieve_validator *valdtr, struct sieve_command *cmd) { - struct sieve_ast_argument *tag = *arg; - struct cmd_test_config_data *ctx_data = - (struct cmd_test_config_data *) (*arg)->argument->data; + struct sieve_ast_argument *arg = cmd->first_positional; - *arg = sieve_ast_argument_next(*arg); - - switch ( ctx_data->action ) { - case CONFIG_ACTION_SET: - /* Check syntax: - * :set <setting: string> <value: string> - */ - if ( !sieve_validate_tag_parameter - (valdtr, cmd, tag, *arg, "setting", 1, SAAT_STRING, TRUE) ) { - return FALSE; - } + /* Check syntax: + * <setting: string> <value: string> + */ - tag->parameters = *arg; - *arg = sieve_ast_argument_next(*arg); + if ( !sieve_validate_positional_argument + (valdtr, cmd, arg, "setting", 1, SAAT_STRING) ) { + return FALSE; + } - if ( !sieve_validate_tag_parameter - (valdtr, cmd, tag, *arg, "value", 2, SAAT_STRING, TRUE) ) { - return FALSE; - } + if ( !sieve_validator_argument_activate(valdtr, cmd, arg, FALSE) ) + return FALSE; - /* Detach parameters */ - *arg = sieve_ast_arguments_detach(tag->parameters,2); - break; - case CONFIG_ACTION_UNSET: - /* Check syntax: - * :unset <setting: string> - */ - if ( !sieve_validate_tag_parameter - (valdtr, cmd, tag, *arg, NULL, 0, SAAT_STRING, TRUE) ) { - return FALSE; - } + arg = sieve_ast_argument_next(arg); - /* Detach parameter */ - tag->parameters = *arg; - *arg = sieve_ast_arguments_detach(*arg,1); - break; - - case CONFIG_ACTION_RELOAD: - /* Check syntax: - * :reload <extension: string> - */ - if ( !sieve_validate_tag_parameter - (valdtr, cmd, tag, *arg, NULL, 0, SAAT_STRING, TRUE) ) { - return FALSE; - } + if ( !sieve_validate_positional_argument + (valdtr, cmd, arg, "value", 2, SAAT_STRING) ) { + return FALSE; + } - /* Detach parameter */ - tag->parameters = *arg; - *arg = sieve_ast_arguments_detach(*arg,1); - break; - default: - i_unreached(); - } - - return TRUE; + return sieve_validator_argument_activate(valdtr, cmd, arg, FALSE); } -static bool tag_action_generate -(const struct sieve_codegen_env *cgenv, struct sieve_ast_argument *arg, - struct sieve_command *cmd) +static bool cmd_test_config_unset_validate +(struct sieve_validator *valdtr, struct sieve_command *cmd) { - struct sieve_ast_argument *param = arg->parameters; - struct cmd_test_config_data *ctx_data = - (struct cmd_test_config_data *) arg->argument->data; - - i_assert(ctx_data->action < CONFIG_ACTION_LAST); + struct sieve_ast_argument *arg = cmd->first_positional; - sieve_operation_emit - (cgenv->sblock, cmd->ext, test_config_operations[ctx_data->action]); - - while ( param != NULL ) { - if ( !sieve_generate_argument(cgenv, param, cmd) ) - return FALSE; + /* Check syntax: + * <setting: string> + */ - param = sieve_ast_argument_next(param); + if ( !sieve_validate_positional_argument + (valdtr, cmd, arg, "setting", 1, SAAT_STRING) ) { + return FALSE; } - return TRUE; + return sieve_validator_argument_activate(valdtr, cmd, arg, FALSE); } /* @@ -265,6 +250,18 @@ static bool tag_action_generate static bool cmd_test_config_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) { + if ( sieve_command_is(cmd, cmd_test_config_set) ) + sieve_operation_emit + (cgenv->sblock, cmd->ext, &test_config_set_operation); + else if ( sieve_command_is(cmd, cmd_test_config_unset) ) + sieve_operation_emit + (cgenv->sblock, cmd->ext, &test_config_unset_operation); + else if ( sieve_command_is(cmd, cmd_test_config_reload) ) + sieve_operation_emit + (cgenv->sblock, cmd->ext, &test_config_reload_operation); + else + i_unreached(); + /* Generate arguments */ if ( !sieve_generate_arguments(cgenv, cmd, NULL) ) return FALSE; @@ -301,12 +298,35 @@ static bool cmd_test_config_unset_operation_dump static bool cmd_test_config_reload_operation_dump (const struct sieve_dumptime_env *denv, sieve_size_t *address) { - sieve_code_dumpf(denv, "TEST_CONFIG_RELOAD:"); + int opt_code = 0; + sieve_code_dumpf(denv, "TEST_CONFIG_RELOAD:"); sieve_code_descend(denv); - return - sieve_opr_string_dump(denv, address, "extension"); + /* Dump optional operands */ + + for (;;) { + int opt; + bool opok = TRUE; + + if ( (opt=sieve_opr_optional_dump(denv, address, &opt_code)) < 0 ) + return FALSE; + + if ( opt == 0 ) break; + + switch ( opt_code ) { + case OPT_EXTENSION: + opok = sieve_opr_string_dump(denv, address, "extensions"); + break; + default: + opok = FALSE; + break; + } + + if ( !opok ) return FALSE; + } + + return TRUE; } /* @@ -338,7 +358,7 @@ static int cmd_test_config_set_operation_execute if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { sieve_runtime_trace(renv, 0, - "testsuite: test_config command"); + "testsuite: test_config_set command"); sieve_runtime_trace_descend(renv); sieve_runtime_trace(renv, 0, "set config `%s' = `%s'", str_c(setting), str_c(value)); @@ -369,7 +389,7 @@ static int cmd_test_config_unset_operation_execute if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { sieve_runtime_trace(renv, 0, - "testsuite: test_config command"); + "testsuite: test_config_unset command"); sieve_runtime_trace_descend(renv); sieve_runtime_trace(renv, 0, "unset config `%s'", str_c(setting)); } @@ -383,17 +403,34 @@ static int cmd_test_config_reload_operation_execute (const struct sieve_runtime_env *renv, sieve_size_t *address) { const struct sieve_extension *ext; - string_t *extension; + int opt_code = 0; + string_t *extension = NULL; int ret; /* * Read operands */ + + /* Optional operands */ + for (;;) { + int opt; + + if ( (opt=sieve_opr_optional_read(renv, address, &opt_code)) < 0 ) + return SIEVE_EXEC_BIN_CORRUPT; + + if ( opt == 0 ) break; + + switch ( opt_code ) { + case OPT_EXTENSION: + ret = sieve_opr_string_read(renv, address, "extension", &extension); + break; + default: + sieve_runtime_trace_error(renv, "unknown optional operand"); + ret = SIEVE_EXEC_BIN_CORRUPT; + } - /* Extension */ - if ( (ret=sieve_opr_string_read(renv, address, "extension", &extension)) - <= 0 ) - return ret; + if ( ret <= 0 ) return ret; + } /* * Perform operation @@ -401,15 +438,25 @@ static int cmd_test_config_reload_operation_execute if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { sieve_runtime_trace(renv, 0, - "testsuite: test_config command"); + "testsuite: test_config_reload command"); sieve_runtime_trace_descend(renv); + } + + if ( extension == NULL ) { + testsuite_test_failf("test_config_reload: " + ":extension argument is currently mandatory"); + return SIEVE_EXEC_OK; + } + + if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { sieve_runtime_trace(renv, 0, "reload configuration for extension `%s'", str_c(extension)); } ext = sieve_extension_get_by_name(renv->svinst, str_c(extension)); if ( ext == NULL ) { - testsuite_test_failf("unknown extension '%s'", str_c(extension)); + testsuite_test_failf("test_config_reload: " + "unknown extension '%s'", str_c(extension)); return SIEVE_EXEC_OK; } diff --git a/src/testsuite/cmd-test-mailbox.c b/src/testsuite/cmd-test-mailbox.c index 51241be231663c233fcda26a1c8fa35cacf83808..874cbc3f49a8c5fe3b0065386f1759373a31ec09 100644 --- a/src/testsuite/cmd-test-mailbox.c +++ b/src/testsuite/cmd-test-mailbox.c @@ -14,26 +14,41 @@ #include "testsuite-mailstore.h" /* - * Test_mailbox command - * - * Syntax: - * test_mailbox ( :create / :delete ) <mailbox: string> + * Commands */ -static bool cmd_test_mailbox_registered - (struct sieve_validator *valdtr, const struct sieve_extension *ext, - struct sieve_command_registration *cmd_reg); static bool cmd_test_mailbox_validate (struct sieve_validator *valdtr, struct sieve_command *cmd); static bool cmd_test_mailbox_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *ctx); -const struct sieve_command_def cmd_test_mailbox = { - "test_mailbox", +/* Test_mailbox_create command + * + * Syntax: + * test_mailbox_create <mailbox: string> + */ + +const struct sieve_command_def cmd_test_mailbox_create = { + "test_mailbox_create", + SCT_COMMAND, + 1, 0, FALSE, FALSE, + NULL, NULL, + cmd_test_mailbox_validate, + cmd_test_mailbox_generate, + NULL +}; + +/* Test_mailbox_delete command + * + * Syntax: + * test_mailbox_create <mailbox: string> + */ + +const struct sieve_command_def cmd_test_mailbox_delete = { + "test_mailbox_delete", SCT_COMMAND, 1, 0, FALSE, FALSE, - cmd_test_mailbox_registered, - NULL, + NULL, NULL, cmd_test_mailbox_validate, cmd_test_mailbox_generate, NULL @@ -68,90 +83,6 @@ const struct sieve_operation_def test_mailbox_delete_operation = { cmd_test_mailbox_operation_execute }; -/* - * Compiler context data - */ - -enum test_mailbox_operation { - MAILBOX_OP_CREATE, - MAILBOX_OP_DELETE, - MAILBOX_OP_LAST -}; - -const struct sieve_operation_def *test_mailbox_operations[] = { - &test_mailbox_create_operation, - &test_mailbox_delete_operation -}; - -struct cmd_test_mailbox_context_data { - enum test_mailbox_operation mailbox_op; - const char *folder; -}; - -/* - * Command tags - */ - -static bool cmd_test_mailbox_validate_tag - (struct sieve_validator *valdtr, struct sieve_ast_argument **arg, - struct sieve_command *cmd); - -static const struct sieve_argument_def test_mailbox_create_tag = { - "create", - NULL, - cmd_test_mailbox_validate_tag, - NULL, NULL, NULL -}; - -static const struct sieve_argument_def test_mailbox_delete_tag = { - "delete", - NULL, - cmd_test_mailbox_validate_tag, - NULL, NULL, NULL -}; - -static bool cmd_test_mailbox_registered -(struct sieve_validator *valdtr, const struct sieve_extension *ext, - struct sieve_command_registration *cmd_reg) -{ - /* Register our tags */ - sieve_validator_register_tag - (valdtr, cmd_reg, ext, &test_mailbox_create_tag, 0); - sieve_validator_register_tag - (valdtr, cmd_reg, ext, &test_mailbox_delete_tag, 0); - - return TRUE; -} - -static bool cmd_test_mailbox_validate_tag -(struct sieve_validator *valdtr, struct sieve_ast_argument **arg, - struct sieve_command *cmd) -{ - struct cmd_test_mailbox_context_data *ctx_data = - (struct cmd_test_mailbox_context_data *) cmd->data; - - if ( ctx_data != NULL ) { - sieve_argument_validate_error - (valdtr, *arg, "exactly one of the ':create' or ':delete' tags must be " - "specified for the test_mailbox command, but more were found"); - return NULL; - } - - ctx_data = p_new - (sieve_command_pool(cmd), struct cmd_test_mailbox_context_data, 1); - cmd->data = ctx_data; - - if ( sieve_argument_is(*arg, test_mailbox_create_tag) ) - ctx_data->mailbox_op = MAILBOX_OP_CREATE; - else - ctx_data->mailbox_op = MAILBOX_OP_DELETE; - - /* Delete this tag */ - *arg = sieve_ast_arguments_detach(*arg, 1); - - return TRUE; -} - /* * Validation */ @@ -160,14 +91,7 @@ static bool cmd_test_mailbox_validate (struct sieve_validator *valdtr, struct sieve_command *cmd) { struct sieve_ast_argument *arg = cmd->first_positional; - - if ( cmd->data == NULL ) { - sieve_command_validate_error(valdtr, cmd, - "the test_mailbox command requires either the :create or the :delete tag " - "to be specified"); - return FALSE; - } - + if ( !sieve_validate_positional_argument (valdtr, cmd, arg, "mailbox", 1, SAAT_STRING) ) { return FALSE; @@ -183,14 +107,15 @@ static bool cmd_test_mailbox_validate static bool cmd_test_mailbox_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) { - struct cmd_test_mailbox_context_data *ctx_data = - (struct cmd_test_mailbox_context_data *) cmd->data; - - i_assert( ctx_data->mailbox_op < MAILBOX_OP_LAST ); - /* Emit operation */ - sieve_operation_emit(cgenv->sblock, cmd->ext, - test_mailbox_operations[ctx_data->mailbox_op]); + if ( sieve_command_is(cmd, cmd_test_mailbox_create) ) + sieve_operation_emit + (cgenv->sblock, cmd->ext, &test_mailbox_create_operation); + else if ( sieve_command_is(cmd, cmd_test_mailbox_delete) ) + sieve_operation_emit + (cgenv->sblock, cmd->ext, &test_mailbox_delete_operation); + else + i_unreached(); /* Generate arguments */ if ( !sieve_generate_arguments(cgenv, cmd, NULL) ) @@ -240,12 +165,21 @@ static int cmd_test_mailbox_operation_execute if ( sieve_operation_is(oprtn, test_mailbox_create_operation) ) { if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { - sieve_runtime_trace(renv, 0, "testsuite/test_mailbox command"); + sieve_runtime_trace(renv, 0, "testsuite/test_mailbox_create command"); sieve_runtime_trace_descend(renv); sieve_runtime_trace(renv, 0, "create mailbox `%s'", str_c(mailbox)); } testsuite_mailstore_mailbox_create(renv, str_c(mailbox)); + } else { + if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) { + sieve_runtime_trace(renv, 0, "testsuite/test_mailbox_delete command"); + sieve_runtime_trace_descend(renv); + sieve_runtime_trace(renv, 0, "delete mailbox `%s'", str_c(mailbox)); + } + + /* FIXME: implement */ + testsuite_test_failf("test_mailbox_delete: NOT IMPLEMENTED"); } return SIEVE_EXEC_OK; diff --git a/src/testsuite/cmd-test-result-print.c b/src/testsuite/cmd-test-result-print.c deleted file mode 100644 index b5da572085404f659585a467246f0c14f549feeb..0000000000000000000000000000000000000000 --- a/src/testsuite/cmd-test-result-print.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (c) 2002-2010 Pigeonhole authors, see the included COPYING file - */ - -#include "sieve-common.h" -#include "sieve-script.h" -#include "sieve-commands.h" -#include "sieve-validator.h" -#include "sieve-generator.h" -#include "sieve-interpreter.h" -#include "sieve-code.h" -#include "sieve-binary.h" -#include "sieve-dump.h" -#include "sieve.h" - -#include "testsuite-common.h" -#include "testsuite-result.h" - -/* - * Test_result_execute command - * - * Syntax: - * test_result_execute - */ - -static bool cmd_test_result_print_generate - (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd); - -const struct sieve_command_def cmd_test_result_print = { - "test_result_print", - SCT_COMMAND, - 0, 0, FALSE, FALSE, - NULL, NULL, NULL, - cmd_test_result_print_generate, - NULL -}; - -/* - * Operation - */ - -static int cmd_test_result_print_operation_execute - (const struct sieve_runtime_env *renv, sieve_size_t *address); - -const struct sieve_operation_def test_result_print_operation = { - "TEST_RESULT_PRINT", - &testsuite_extension, - TESTSUITE_OPERATION_TEST_RESULT_PRINT, - NULL, - cmd_test_result_print_operation_execute -}; - -/* - * Code generation - */ - -static bool cmd_test_result_print_generate -(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) -{ - sieve_operation_emit(cgenv->sblock, cmd->ext, &test_result_print_operation); - - return TRUE; -} - -/* - * Intepretation - */ - -static int cmd_test_result_print_operation_execute -(const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED) -{ - sieve_runtime_trace(renv, SIEVE_TRLVL_COMMANDS, - "testsuite: test_result_print command; print script result "); - - testsuite_result_print(renv); - - return SIEVE_EXEC_OK; -} - - - - diff --git a/src/testsuite/cmd-test-result-reset.c b/src/testsuite/cmd-test-result-reset.c deleted file mode 100644 index 467e8a417c784d6ee5e27b7244b32530d8b4eb5a..0000000000000000000000000000000000000000 --- a/src/testsuite/cmd-test-result-reset.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2002-2010 Pigeonhole authors, see the included COPYING file - */ - -#include "sieve-common.h" -#include "sieve-script.h" -#include "sieve-commands.h" -#include "sieve-validator.h" -#include "sieve-generator.h" -#include "sieve-interpreter.h" -#include "sieve-code.h" -#include "sieve-binary.h" -#include "sieve-dump.h" -#include "sieve.h" - -#include "testsuite-common.h" -#include "testsuite-result.h" -#include "testsuite-smtp.h" - -/* - * Test_result_execute command - * - * Syntax: - * test_result_execute - */ - -static bool cmd_test_result_reset_generate - (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd); - -const struct sieve_command_def cmd_test_result_reset = { - "test_result_reset", - SCT_COMMAND, - 0, 0, FALSE, FALSE, - NULL, NULL, NULL, - cmd_test_result_reset_generate, - NULL -}; - -/* - * Operation - */ - -static int cmd_test_result_reset_operation_execute - (const struct sieve_runtime_env *renv, sieve_size_t *address); - -const struct sieve_operation_def test_result_reset_operation = { - "TEST_RESULT_RESET", - &testsuite_extension, - TESTSUITE_OPERATION_TEST_RESULT_RESET, - NULL, - cmd_test_result_reset_operation_execute -}; - -/* - * Code generation - */ - -static bool cmd_test_result_reset_generate -(const struct sieve_codegen_env *cgenv, struct sieve_command *tst) -{ - sieve_operation_emit(cgenv->sblock, tst->ext, &test_result_reset_operation); - - return TRUE; -} - -/* - * Intepretation - */ - -static int cmd_test_result_reset_operation_execute -(const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED) -{ - sieve_runtime_trace(renv, SIEVE_TRLVL_COMMANDS, - "testsuite: test_result_reset command; reset script result"); - - testsuite_result_reset(renv); - testsuite_smtp_reset(); - - return SIEVE_EXEC_OK; -} - - - - diff --git a/src/testsuite/cmd-test-result.c b/src/testsuite/cmd-test-result.c new file mode 100644 index 0000000000000000000000000000000000000000..2075b7f263b6383646bc7ad2039f74363f878310 --- /dev/null +++ b/src/testsuite/cmd-test-result.c @@ -0,0 +1,132 @@ +/* Copyright (c) 2002-2010 Pigeonhole authors, see the included COPYING file + */ + +#include "sieve-common.h" +#include "sieve-script.h" +#include "sieve-commands.h" +#include "sieve-validator.h" +#include "sieve-generator.h" +#include "sieve-interpreter.h" +#include "sieve-code.h" +#include "sieve-binary.h" +#include "sieve-dump.h" +#include "sieve.h" + +#include "testsuite-common.h" +#include "testsuite-result.h" +#include "testsuite-smtp.h" + +/* + * Commands + */ + +static bool cmd_test_result_generate + (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd); + +/* Test_result_reset command + * + * Syntax: + * test_result_reset + */ + +const struct sieve_command_def cmd_test_result_reset = { + "test_result_reset", + SCT_COMMAND, + 0, 0, FALSE, FALSE, + NULL, NULL, NULL, + cmd_test_result_generate, + NULL +}; + +/* Test_result_print command + * + * Syntax: + * test_result_print + */ + +const struct sieve_command_def cmd_test_result_print = { + "test_result_print", + SCT_COMMAND, + 0, 0, FALSE, FALSE, + NULL, NULL, NULL, + cmd_test_result_generate, + NULL +}; + +/* + * Operations + */ + +/* test_result_reset */ + +static int cmd_test_result_reset_operation_execute + (const struct sieve_runtime_env *renv, sieve_size_t *address); + +const struct sieve_operation_def test_result_reset_operation = { + "TEST_RESULT_RESET", + &testsuite_extension, + TESTSUITE_OPERATION_TEST_RESULT_RESET, + NULL, + cmd_test_result_reset_operation_execute +}; + +/* test_result_print */ + +static int cmd_test_result_print_operation_execute + (const struct sieve_runtime_env *renv, sieve_size_t *address); + +const struct sieve_operation_def test_result_print_operation = { + "TEST_RESULT_PRINT", + &testsuite_extension, + TESTSUITE_OPERATION_TEST_RESULT_PRINT, + NULL, + cmd_test_result_print_operation_execute +}; + +/* + * Code generation + */ + +static bool cmd_test_result_generate +(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) +{ + if ( sieve_command_is(cmd, cmd_test_result_reset) ) + sieve_operation_emit(cgenv->sblock, cmd->ext, &test_result_reset_operation); + else if ( sieve_command_is(cmd, cmd_test_result_print) ) + sieve_operation_emit(cgenv->sblock, cmd->ext, &test_result_print_operation); + else + i_unreached(); + + return TRUE; +} + +/* + * Intepretation + */ + +static int cmd_test_result_reset_operation_execute +(const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED) +{ + sieve_runtime_trace(renv, SIEVE_TRLVL_COMMANDS, + "testsuite: test_result_reset command; reset script result"); + + testsuite_result_reset(renv); + testsuite_smtp_reset(); + + return SIEVE_EXEC_OK; +} + +static int cmd_test_result_print_operation_execute +(const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED) +{ + sieve_runtime_trace(renv, SIEVE_TRLVL_COMMANDS, + "testsuite: test_result_print command; print script result "); + + testsuite_result_print(renv); + + return SIEVE_EXEC_OK; +} + + + + diff --git a/src/testsuite/ext-testsuite.c b/src/testsuite/ext-testsuite.c index 40efa59f71254486ff867dcd4c604fd64fb1658c..b073e4d9bf04d167bebaf8e2330f575c3d02e151 100644 --- a/src/testsuite/ext-testsuite.c +++ b/src/testsuite/ext-testsuite.c @@ -63,7 +63,7 @@ const struct sieve_operation_def *testsuite_operations[] = { &test_script_run_operation, &test_multiscript_operation, &test_error_operation, - &test_result_operation, + &test_result_action_operation, &test_result_execute_operation, &test_result_reset_operation, &test_result_print_operation, @@ -118,20 +118,24 @@ static bool ext_testsuite_validator_load { sieve_validator_register_command(valdtr, ext, &cmd_test); sieve_validator_register_command(valdtr, ext, &cmd_test_fail); - sieve_validator_register_command(valdtr, ext, &cmd_test_config); + sieve_validator_register_command(valdtr, ext, &cmd_test_config_set); + sieve_validator_register_command(valdtr, ext, &cmd_test_config_unset); + sieve_validator_register_command(valdtr, ext, &cmd_test_config_reload); sieve_validator_register_command(valdtr, ext, &cmd_test_set); sieve_validator_register_command(valdtr, ext, &cmd_test_result_print); sieve_validator_register_command(valdtr, ext, &cmd_test_result_reset); sieve_validator_register_command(valdtr, ext, &cmd_test_message); - sieve_validator_register_command(valdtr, ext, &cmd_test_mailbox); - sieve_validator_register_command(valdtr, ext, &cmd_test_binary); + sieve_validator_register_command(valdtr, ext, &cmd_test_mailbox_create); + sieve_validator_register_command(valdtr, ext, &cmd_test_mailbox_delete); + sieve_validator_register_command(valdtr, ext, &cmd_test_binary_load); + sieve_validator_register_command(valdtr, ext, &cmd_test_binary_save); sieve_validator_register_command(valdtr, ext, &tst_test_script_compile); sieve_validator_register_command(valdtr, ext, &tst_test_script_run); sieve_validator_register_command(valdtr, ext, &tst_test_multiscript); sieve_validator_register_command(valdtr, ext, &tst_test_error); - sieve_validator_register_command(valdtr, ext, &tst_test_result); - sieve_validator_register_command(valdtr, ext, &tst_test_result_execute); + sieve_validator_register_command(valdtr, ext, &tst_test_result_action); + sieve_validator_register_command(valdtr, ext, &tst_test_result_execute); /* sieve_validator_argument_override(valdtr, SAT_VAR_STRING, ext, &testsuite_string_argument);*/ diff --git a/src/testsuite/testsuite-common.h b/src/testsuite/testsuite-common.h index 47d44a9c1485035685155761d3b0f550f92fd6fe..b817e3a7fae66bff55d821f605cd2aa87f056386 100644 --- a/src/testsuite/testsuite-common.h +++ b/src/testsuite/testsuite-common.h @@ -50,13 +50,18 @@ bool testsuite_generator_context_initialize extern const struct sieve_command_def cmd_test; extern const struct sieve_command_def cmd_test_fail; -extern const struct sieve_command_def cmd_test_config; +extern const struct sieve_command_def cmd_test_config_set; +extern const struct sieve_command_def cmd_test_config_unset; +extern const struct sieve_command_def cmd_test_config_reload; extern const struct sieve_command_def cmd_test_set; extern const struct sieve_command_def cmd_test_result_reset; extern const struct sieve_command_def cmd_test_result_print; extern const struct sieve_command_def cmd_test_message; extern const struct sieve_command_def cmd_test_mailbox; -extern const struct sieve_command_def cmd_test_binary; +extern const struct sieve_command_def cmd_test_mailbox_create; +extern const struct sieve_command_def cmd_test_mailbox_delete; +extern const struct sieve_command_def cmd_test_binary_load; +extern const struct sieve_command_def cmd_test_binary_save; /* * Tests @@ -66,7 +71,7 @@ extern const struct sieve_command_def tst_test_script_compile; extern const struct sieve_command_def tst_test_script_run; extern const struct sieve_command_def tst_test_multiscript; extern const struct sieve_command_def tst_test_error; -extern const struct sieve_command_def tst_test_result; +extern const struct sieve_command_def tst_test_result_action; extern const struct sieve_command_def tst_test_result_execute; /* @@ -85,7 +90,7 @@ enum testsuite_operation_code { TESTSUITE_OPERATION_TEST_SCRIPT_RUN, TESTSUITE_OPERATION_TEST_MULTISCRIPT, TESTSUITE_OPERATION_TEST_ERROR, - TESTSUITE_OPERATION_TEST_RESULT, + TESTSUITE_OPERATION_TEST_RESULT_ACTION, TESTSUITE_OPERATION_TEST_RESULT_EXECUTE, TESTSUITE_OPERATION_TEST_RESULT_RESET, TESTSUITE_OPERATION_TEST_RESULT_PRINT, @@ -108,7 +113,7 @@ extern const struct sieve_operation_def test_script_compile_operation; extern const struct sieve_operation_def test_script_run_operation; extern const struct sieve_operation_def test_multiscript_operation; extern const struct sieve_operation_def test_error_operation; -extern const struct sieve_operation_def test_result_operation; +extern const struct sieve_operation_def test_result_action_operation; extern const struct sieve_operation_def test_result_execute_operation; extern const struct sieve_operation_def test_result_reset_operation; extern const struct sieve_operation_def test_result_print_operation; diff --git a/src/testsuite/tst-test-result.c b/src/testsuite/tst-test-result-action.c similarity index 76% rename from src/testsuite/tst-test-result.c rename to src/testsuite/tst-test-result-action.c index 0bba25f23d45cc959d5a0ea68f2c402dfa72f9d4..ea60a128e15c54136e28c9d97947a9e89c00570e 100644 --- a/src/testsuite/tst-test-result.c +++ b/src/testsuite/tst-test-result-action.c @@ -1,11 +1,6 @@ /* Copyright (c) 2002-2010 Pigeonhole authors, see the included COPYING file */ -/* FIXME: this file is very similar to tst-test-error.c. Maybe it is best to - * implement errors and actions as testsuite-objects and implement a common - * interface to test these. - */ - #include "sieve-common.h" #include "sieve-error.h" #include "sieve-script.h" @@ -26,29 +21,29 @@ #include "testsuite-result.h" /* - * test_result command + * test_result_action command * * Syntax: - * test_result [MATCH-TYPE] [COMPARATOR] [:index number] + * test_result_action [MATCH-TYPE] [COMPARATOR] [:index number] * <key-list: string-list> */ -static bool tst_test_result_registered +static bool tst_test_result_action_registered (struct sieve_validator *validator, const struct sieve_extension *ext, struct sieve_command_registration *cmd_reg); -static bool tst_test_result_validate +static bool tst_test_result_action_validate (struct sieve_validator *validator, struct sieve_command *cmd); -static bool tst_test_result_generate +static bool tst_test_result_action_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *ctx); -const struct sieve_command_def tst_test_result = { - "test_result", +const struct sieve_command_def tst_test_result_action = { + "test_result_action", SCT_TEST, 1, 0, FALSE, FALSE, - tst_test_result_registered, + tst_test_result_action_registered, NULL, - tst_test_result_validate, - tst_test_result_generate, + tst_test_result_action_validate, + tst_test_result_action_generate, NULL }; @@ -56,17 +51,17 @@ const struct sieve_command_def tst_test_result = { * Operation */ -static bool tst_test_result_operation_dump +static bool tst_test_result_action_operation_dump (const struct sieve_dumptime_env *denv, sieve_size_t *address); -static int tst_test_result_operation_execute +static int tst_test_result_action_operation_execute (const struct sieve_runtime_env *renv, sieve_size_t *address); -const struct sieve_operation_def test_result_operation = { - "test_result", +const struct sieve_operation_def test_result_action_operation = { + "TEST_RESULT_ACTION", &testsuite_extension, - TESTSUITE_OPERATION_TEST_RESULT, - tst_test_result_operation_dump, - tst_test_result_operation_execute + TESTSUITE_OPERATION_TEST_RESULT_ACTION, + tst_test_result_action_operation_dump, + tst_test_result_action_operation_execute }; /* @@ -75,18 +70,18 @@ const struct sieve_operation_def test_result_operation = { /* FIXME: merge this with the test_error version of this tag */ -static bool tst_test_result_validate_index_tag +static bool tst_test_result_action_validate_index_tag (struct sieve_validator *validator, struct sieve_ast_argument **arg, struct sieve_command *cmd); -static const struct sieve_argument_def test_result_index_tag = { +static const struct sieve_argument_def test_result_action_index_tag = { "index", NULL, - tst_test_result_validate_index_tag, + tst_test_result_action_validate_index_tag, NULL, NULL, NULL }; -enum tst_test_result_optional { +enum tst_test_result_action_optional { OPT_INDEX = SIEVE_MATCH_OPT_LAST, }; @@ -94,7 +89,7 @@ enum tst_test_result_optional { * Argument implementation */ -static bool tst_test_result_validate_index_tag +static bool tst_test_result_action_validate_index_tag (struct sieve_validator *validator, struct sieve_ast_argument **arg, struct sieve_command *cmd) { @@ -121,7 +116,7 @@ static bool tst_test_result_validate_index_tag * Command registration */ -static bool tst_test_result_registered +static bool tst_test_result_action_registered (struct sieve_validator *validator, const struct sieve_extension *ext, struct sieve_command_registration *cmd_reg) { @@ -130,7 +125,7 @@ static bool tst_test_result_registered sieve_match_types_link_tags(validator, cmd_reg, SIEVE_MATCH_OPT_MATCH_TYPE); sieve_validator_register_tag - (validator, cmd_reg, ext, &test_result_index_tag, OPT_INDEX); + (validator, cmd_reg, ext, &test_result_action_index_tag, OPT_INDEX); return TRUE; } @@ -139,7 +134,7 @@ static bool tst_test_result_registered * Validation */ -static bool tst_test_result_validate +static bool tst_test_result_action_validate (struct sieve_validator *valdtr ATTR_UNUSED, struct sieve_command *tst) { struct sieve_ast_argument *arg = tst->first_positional; @@ -165,10 +160,10 @@ static bool tst_test_result_validate * Code generation */ -static bool tst_test_result_generate +static bool tst_test_result_action_generate (const struct sieve_codegen_env *cgenv, struct sieve_command *tst) { - sieve_operation_emit(cgenv->sblock, tst->ext, &test_result_operation); + sieve_operation_emit(cgenv->sblock, tst->ext, &test_result_action_operation); /* Generate arguments */ return sieve_generate_arguments(cgenv, tst, NULL); @@ -178,12 +173,12 @@ static bool tst_test_result_generate * Code dump */ -static bool tst_test_result_operation_dump +static bool tst_test_result_action_operation_dump (const struct sieve_dumptime_env *denv, sieve_size_t *address) { int opt_code = 0; - sieve_code_dumpf(denv, "TEST_RESULT:"); + sieve_code_dumpf(denv, "TEST_RESULT_ACTION:"); sieve_code_descend(denv); /* Handle any optional arguments */ @@ -211,7 +206,7 @@ static bool tst_test_result_operation_dump * Intepretation */ -static int tst_test_result_operation_execute +static int tst_test_result_action_operation_execute (const struct sieve_runtime_env *renv, sieve_size_t *address) { int opt_code = 0; @@ -256,7 +251,7 @@ static int tst_test_result_operation_execute */ sieve_runtime_trace(renv, SIEVE_TRLVL_TESTS, - "testsuite: test_result test; match result name (index: %d)", index); + "testsuite: test_result_action test; match result name (index: %d)", index); /* Create value stringlist */ value_list = testsuite_result_stringlist_create(renv, index); diff --git a/tests/deprecated/notify/execute.svtest b/tests/deprecated/notify/execute.svtest index 83ca40141ab8cbd467b8b5671b9b4af7ba076cc7..90fde474ec9d7fe01af093a92727f96ae480aad3 100644 --- a/tests/deprecated/notify/execute.svtest +++ b/tests/deprecated/notify/execute.svtest @@ -15,7 +15,7 @@ test "Duplicate recipients" { test_fail "script execute failed"; } - if test_result :count "ne" "2" { + if test_result_action :count "ne" "2" { test_fail "second notify action was discarded entirely"; } diff --git a/tests/execute/actions.svtest b/tests/execute/actions.svtest index ab70db9290ef7d65c08fa8e82be6d2f77fb32dcf..6225d39917fa6215b127b7afd4c242f01c9d40f5 100644 --- a/tests/execute/actions.svtest +++ b/tests/execute/actions.svtest @@ -11,8 +11,8 @@ Test. . ; -test_mailbox :create "INBOX.VB"; -test_mailbox :create "INBOX.backup"; +test_mailbox_create "INBOX.VB"; +test_mailbox_create "INBOX.backup"; test "Fileinto" { if not test_script_compile "actions/fileinto.sieve" { @@ -23,19 +23,19 @@ test "Fileinto" { test_fail "script run failed"; } - if not test_result :count "eq" :comparator "i;ascii-numeric" "3" { + if not test_result_action :count "eq" :comparator "i;ascii-numeric" "3" { test_fail "wrong number of actions in result"; } - if not test_result :index 1 "store" { + if not test_result_action :index 1 "store" { test_fail "first action is not 'store'"; } - if not test_result :index 2 "store" { + if not test_result_action :index 2 "store" { test_fail "second action is not 'store'"; } - if not test_result :index 3 "keep" { + if not test_result_action :index 3 "keep" { test_fail "third action is not 'keep'"; } @@ -53,23 +53,23 @@ test "Redirect" { test_fail "execute failed"; } - if not test_result :count "eq" :comparator "i;ascii-numeric" "4" { + if not test_result_action :count "eq" :comparator "i;ascii-numeric" "4" { test_fail "wrong number of actions in result"; } - if not test_result :index 1 "redirect" { + if not test_result_action :index 1 "redirect" { test_fail "first action is not 'redirect'"; } - if not test_result :index 2 "keep" { + if not test_result_action :index 2 "keep" { test_fail "second action is not 'keep'"; } - if not test_result :index 3 "redirect" { + if not test_result_action :index 3 "redirect" { test_fail "third action is not 'redirect'"; } - if not test_result :index 4 "redirect" { + if not test_result_action :index 4 "redirect" { test_fail "fourth action is not 'redirect'"; } diff --git a/tests/execute/errors.svtest b/tests/execute/errors.svtest index ec5c57846223ee96c4c39ab4b335618fbd8322a5..7d4658a6f0a891818a3f1fb60d9fc3fa543b1467 100644 --- a/tests/execute/errors.svtest +++ b/tests/execute/errors.svtest @@ -87,7 +87,7 @@ test "Fileinto missing folder" { test_fail "compile failed"; } - test_mailbox :create "INBOX"; + test_mailbox_create "INBOX"; if not test_script_run { test_fail "execution failed"; diff --git a/tests/execute/examples.svtest b/tests/execute/examples.svtest index 3f0416ab4098b5797fe267e4787afdeae4aa83cb..57053eecaed18ed3ff91d626dc22428abc7d7bce 100644 --- a/tests/execute/examples.svtest +++ b/tests/execute/examples.svtest @@ -9,8 +9,8 @@ test "Elvey example" { test_fail "could not compile"; } - test_binary :save "elvey"; - test_binary :load "elvey"; + test_binary_save "elvey"; + test_binary_load "elvey"; if not test_script_run { } } @@ -20,8 +20,8 @@ test "M. Johnson example" { test_fail "could not compile"; } - test_binary :save "mjohnson"; - test_binary :load "mjohnson"; + test_binary_save "mjohnson"; + test_binary_load "mjohnson"; if not test_script_run { } } @@ -31,8 +31,8 @@ test "RFC 3028 example" { test_fail "could not compile"; } - test_binary :save "rfc3028"; - test_binary :load "rfc3028"; + test_binary_save "rfc3028"; + test_binary_load "rfc3028"; if not test_script_run { } } @@ -42,8 +42,8 @@ test "Sieve examples" { test_fail "could not compile"; } - test_binary :save "sieve_examples"; - test_binary :load "sieve_examples"; + test_binary_save "sieve_examples"; + test_binary_load "sieve_examples"; if not test_script_run { } } @@ -53,8 +53,8 @@ test "Vivil example" { test_fail "could not compile"; } - test_binary :save "vivil"; - test_binary :load "vivil"; + test_binary_save "vivil"; + test_binary_load "vivil"; if not test_script_run { } } @@ -64,8 +64,8 @@ test "Jerry example" { test_fail "could not compile"; } - test_binary :save "jerry"; - test_binary :load "jerry"; + test_binary_save "jerry"; + test_binary_load "jerry"; if not test_script_run { } } @@ -75,8 +75,8 @@ test "M. Klose example" { test_fail "could not compile"; } - test_binary :save "mklose"; - test_binary :load "mklose"; + test_binary_save "mklose"; + test_binary_load "mklose"; if not test_script_run { } } @@ -86,8 +86,8 @@ test "Sanjay example" { test_fail "could not compile"; } - test_binary :save "sanjay"; - test_binary :load "sanjay"; + test_binary_save "sanjay"; + test_binary_load "sanjay"; if not test_script_run { } } @@ -97,8 +97,8 @@ test "Relational (RFC5231) example" { test_fail "could not compile"; } - test_binary :save "relational"; - test_binary :load "relational"; + test_binary_save "relational"; + test_binary_load "relational"; if not test_script_run { } } @@ -108,8 +108,8 @@ test "Subaddress (RFC5233) example" { test_fail "could not compile"; } - test_binary :save "subaddress"; - test_binary :load "subaddress"; + test_binary_save "subaddress"; + test_binary_load "subaddress"; if not test_script_run { } } diff --git a/tests/extensions/enotify/execute.svtest b/tests/extensions/enotify/execute.svtest index 63b31e89b37db92b9323fa31a497943f4ba69deb..cd6486de9f20feec7a6e9291c01fbcf0f57e633b 100644 --- a/tests/extensions/enotify/execute.svtest +++ b/tests/extensions/enotify/execute.svtest @@ -89,7 +89,7 @@ test "Duplicate recipients" { test_fail "script execute failed"; } - if test_result :count "ne" "2" { + if test_result_action :count "ne" "2" { test_fail "second notify action was discarded entirely"; } diff --git a/tests/extensions/imap4flags/execute.svtest b/tests/extensions/imap4flags/execute.svtest index ca065ce45ead1d133f98e0920b9fa0375f5cfdcb..4aa5c613876e301f85a307777927e483aa21b5ac 100644 --- a/tests/extensions/imap4flags/execute.svtest +++ b/tests/extensions/imap4flags/execute.svtest @@ -4,8 +4,8 @@ require "vnd.dovecot.testsuite"; * Execution testing (currently just meant to trigger any segfaults) */ -test_mailbox :create "INBOX.Junk"; -test_mailbox :create "INBOX.Nonsense"; +test_mailbox_create "INBOX.Junk"; +test_mailbox_create "INBOX.Nonsense"; test "Flags Side Effect" { if not test_script_compile "execute/flags-side-effect.sieve" { diff --git a/tests/extensions/include/execute.svtest b/tests/extensions/include/execute.svtest index e45848af49988f4a4a8c6bed2242a9ea6ec62e8b..5ad9c7b5a28f55d5fee9d88bdf3e8a3e8cb36b8c 100644 --- a/tests/extensions/include/execute.svtest +++ b/tests/extensions/include/execute.svtest @@ -10,15 +10,15 @@ Frop. ; test "Actions Fileinto" { - test_mailbox :create "aaaa"; - test_mailbox :create "bbbb"; + test_mailbox_create "aaaa"; + test_mailbox_create "bbbb"; if not test_script_compile "execute/actions-fileinto.sieve" { test_fail "failed to compile sieve script"; } - test_binary :save "actions-fileinto"; - test_binary :load "actions-fileinto"; + test_binary_save "actions-fileinto"; + test_binary_load "actions-fileinto"; if not test_script_run { test_fail "failed to execute sieve script"; @@ -34,7 +34,7 @@ test "Actions Fileinto" { test_fail "fileinto \"aaaa\" not executed."; } - test_message :folder "aaaa" 0; + test_message :folder "bbbb" 0; if not header "subject" "Frop!" { test_fail "fileinto \"bbbb\" not executed."; diff --git a/tests/extensions/mailbox/execute.svtest b/tests/extensions/mailbox/execute.svtest index f45486127290d878ca4118c69e18eead1e643572..cba3034b482a38237aef8498b439faa5cfa35730 100644 --- a/tests/extensions/mailbox/execute.svtest +++ b/tests/extensions/mailbox/execute.svtest @@ -8,8 +8,8 @@ test "MailboxExists - None exist" { } } -test_mailbox :create "frop"; -test_mailbox :create "friep"; +test_mailbox_create "frop"; +test_mailbox_create "friep"; test "MailboxExists - Not all exist" { if mailboxexists ["frop", "friep", "frml"] { @@ -17,7 +17,7 @@ test "MailboxExists - Not all exist" { } } -test_mailbox :create "frml"; +test_mailbox_create "frml"; test "MailboxExists - One exists" { if not mailboxexists ["frop"] { diff --git a/tests/extensions/reject/execute.svtest b/tests/extensions/reject/execute.svtest index a9a801cf4269a86e1d1037ab378a6df7954570ac..20a0bdf464b49a18fd5ecf33f30fac36841fa7ef 100644 --- a/tests/extensions/reject/execute.svtest +++ b/tests/extensions/reject/execute.svtest @@ -20,11 +20,11 @@ test "Execute" { test_fail "script run failed"; } - if not test_result :count "eq" :comparator "i;ascii-numeric" "1" { + if not test_result_action :count "eq" :comparator "i;ascii-numeric" "1" { test_fail "invalid number of actions in result"; } - if not test_result :index 1 "reject" { + if not test_result_action :index 1 "reject" { test_fail "reject action missing from result"; } diff --git a/tests/extensions/spamvirustest/spamtest.svtest b/tests/extensions/spamvirustest/spamtest.svtest index c6f04980ad5e97a0461dfcd870c08dab86cc4f0a..458dc626592d22f9a326c0f2ca1acc024a65dd6b 100644 --- a/tests/extensions/spamvirustest/spamtest.svtest +++ b/tests/extensions/spamvirustest/spamtest.svtest @@ -23,12 +23,12 @@ Test! . ; -test_config :set "sieve_spamtest_status_header" +test_config_set "sieve_spamtest_status_header" "X-SpamCheck:[ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)"; -test_config :set "sieve_spamtest_max_header" +test_config_set "sieve_spamtest_max_header" "X-SpamCheck:[ \\ta-zA-Z]+, score=-?[0-9]+.[0-9]+ required=(-?[0-9]+.[0-9]+)"; -test_config :set "sieve_spamtest_status_type" "score"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_type" "score"; +test_config_reload :extension "spamtest"; test "Value: subzero" { if spamtest :is "0" { @@ -45,9 +45,9 @@ test "Value: subzero" { } } -test_config :set "sieve_spamtest_status_header" +test_config_set "sieve_spamtest_status_header" "X-SpamCheck1:[ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)"; -test_config :reload "spamtest"; +test_config_reload :extension "spamtest"; test "Value: zero" { if spamtest :is "0" { @@ -64,9 +64,9 @@ test "Value: zero" { } } -test_config :set "sieve_spamtest_status_header" +test_config_set "sieve_spamtest_status_header" "X-SpamCheck2:[ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)"; -test_config :reload "spamtest"; +test_config_reload :extension "spamtest"; test "Value: low" { if spamtest :is "0" { @@ -83,9 +83,9 @@ test "Value: low" { } } -test_config :set "sieve_spamtest_status_header" +test_config_set "sieve_spamtest_status_header" "X-SpamCheck3: [ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)"; -test_config :reload "spamtest"; +test_config_reload :extension "spamtest"; test "Value: high" { if spamtest :is "0" { @@ -98,9 +98,9 @@ test "Value: high" { } } -test_config :set "sieve_spamtest_status_header" +test_config_set "sieve_spamtest_status_header" "X-SpamCheck4:[ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)"; -test_config :reload "spamtest"; +test_config_reload :extension "spamtest"; test "Value: max" { if spamtest :is "0" { @@ -113,9 +113,9 @@ test "Value: max" { } } -test_config :set "sieve_spamtest_status_header" +test_config_set "sieve_spamtest_status_header" "X-SpamCheck5:[ \\ta-zA-Z]+, score=(-?[0-9]+.[0-9]+)"; -test_config :reload "spamtest"; +test_config_reload :extension "spamtest"; test "Value: past-max" { if spamtest :is "0" { @@ -146,11 +146,11 @@ Test! . ; -test_config :set "sieve_spamtest_status_header" "X-Spam-Status"; -test_config :set "sieve_spamtest_max_value" "8.0"; -test_config :set "sieve_spamtest_status_type" "strlen"; -test_config :unset "sieve_spamtest_max_header"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Status"; +test_config_set "sieve_spamtest_max_value" "8.0"; +test_config_set "sieve_spamtest_status_type" "strlen"; +test_config_unset "sieve_spamtest_max_header"; +test_config_reload :extension "spamtest"; test "Strlen: zero" { if spamtest :is "0" { @@ -167,8 +167,8 @@ test "Strlen: zero" { } } -test_config :set "sieve_spamtest_status_header" "X-Spam-Status1"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Status1"; +test_config_reload :extension "spamtest"; test "Strlen: low" { if spamtest :is "0" { @@ -185,8 +185,8 @@ test "Strlen: low" { } } -test_config :set "sieve_spamtest_status_header" "X-Spam-Status2"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Status2"; +test_config_reload :extension "spamtest"; test "Strlen: high" { if spamtest :is "0" { @@ -199,8 +199,8 @@ test "Strlen: high" { } } -test_config :set "sieve_spamtest_status_header" "X-Spam-Status3"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Status3"; +test_config_reload :extension "spamtest"; test "Strlen: max" { if spamtest :is "0" { @@ -213,8 +213,8 @@ test "Strlen: max" { } } -test_config :set "sieve_spamtest_status_header" "X-Spam-Status4"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Status4"; +test_config_reload :extension "spamtest"; test "Strlen: past-max" { if spamtest :is "0" { @@ -241,13 +241,13 @@ Test! . ; -test_config :set "sieve_spamtest_status_header" "X-Spam-Verdict"; -test_config :set "sieve_spamtest_status_type" "text"; -test_config :set "sieve_spamtest_text_value1" "Not Spam"; -test_config :set "sieve_spamtest_text_value10" "Spam"; -test_config :unset "sieve_spamtest_max_header"; -test_config :unset "sieve_spamtest_max_value"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Verdict"; +test_config_set "sieve_spamtest_status_type" "text"; +test_config_set "sieve_spamtest_text_value1" "Not Spam"; +test_config_set "sieve_spamtest_text_value10" "Spam"; +test_config_unset "sieve_spamtest_max_header"; +test_config_unset "sieve_spamtest_max_value"; +test_config_reload :extension "spamtest"; test "Text: Not Spam" { if spamtest :is "0" { @@ -260,8 +260,8 @@ test "Text: Not Spam" { } } -test_config :set "sieve_spamtest_status_header" "X-Spam-Verdict1"; -test_config :reload "spamtest"; +test_config_set "sieve_spamtest_status_header" "X-Spam-Verdict1"; +test_config_reload :extension "spamtest"; test "Text: Spam" { if spamtest :is "0" { diff --git a/tests/extensions/spamvirustest/spamtestplus.svtest b/tests/extensions/spamvirustest/spamtestplus.svtest index 8459e56fc0b5805f27a85f9aa0c639929721c5ab..07b860386a858d5983a78841950444ba841ce46b 100644 --- a/tests/extensions/spamvirustest/spamtestplus.svtest +++ b/tests/extensions/spamvirustest/spamtestplus.svtest @@ -24,10 +24,10 @@ Test! . ; -test_config :set "sieve_spamtest_status_header" "X-SpamCheck"; -test_config :set "sieve_spamtest_max_value" "1"; -test_config :set "sieve_spamtest_status_type" "score"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck"; +test_config_set "sieve_spamtest_max_value" "1"; +test_config_set "sieve_spamtest_status_type" "score"; +test_config_reload :extension "spamtestplus"; test "Value percent: .00" { if not spamtest :percent :is "0" { @@ -36,8 +36,8 @@ test "Value percent: .00" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck1"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck1"; +test_config_reload :extension "spamtestplus"; test "Value percent: .01" { if spamtest :percent :is "0" { @@ -50,8 +50,8 @@ test "Value percent: .01" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck2"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck2"; +test_config_reload :extension "spamtestplus"; test "Value percent: .13" { if spamtest :percent :is "0" { @@ -64,8 +64,8 @@ test "Value percent: .13" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck3"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck3"; +test_config_reload :extension "spamtestplus"; test "Value percent: .29" { if spamtest :percent :is "0" { @@ -78,8 +78,8 @@ test "Value percent: .29" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck4"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck4"; +test_config_reload :extension "spamtestplus"; test "Value percent: .51" { if spamtest :percent :is "0" { @@ -92,8 +92,8 @@ test "Value percent: .51" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck5"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck5"; +test_config_reload :extension "spamtestplus"; test "Value percent: .73" { if spamtest :percent :is "0" { @@ -106,8 +106,8 @@ test "Value percent: .73" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck6"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck6"; +test_config_reload :extension "spamtestplus"; test "Value percent: .89" { if spamtest :percent :is "0" { @@ -120,8 +120,8 @@ test "Value percent: .89" { } } -test_config :set "sieve_spamtest_status_header" "X-SpamCheck7"; -test_config :reload "spamtestplus"; +test_config_set "sieve_spamtest_status_header" "X-SpamCheck7"; +test_config_reload :extension "spamtestplus"; test "Value percent: 1.01" { if spamtest :percent :is "0" { diff --git a/tests/extensions/spamvirustest/virustest.svtest b/tests/extensions/spamvirustest/virustest.svtest index 6be85280827f9cc1cab8f0115101579783027665..ea2d9eaf4a6f4300d6304a8f5ce21ae0ea84e19d 100644 --- a/tests/extensions/spamvirustest/virustest.svtest +++ b/tests/extensions/spamvirustest/virustest.svtest @@ -25,14 +25,14 @@ Test! . ; -test_config :set "sieve_virustest_status_header" "X-VirusCheck"; -test_config :set "sieve_virustest_status_type" "text"; -test_config :set "sieve_virustest_text_value1" "Clean"; -test_config :set "sieve_virustest_text_value2" "Presumed Clean"; -test_config :set "sieve_virustest_text_value3" "Not sure"; -test_config :set "sieve_virustest_text_value4" "Almost Certain"; -test_config :set "sieve_virustest_text_value5" "Definitely"; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-VirusCheck"; +test_config_set "sieve_virustest_status_type" "text"; +test_config_set "sieve_virustest_text_value1" "Clean"; +test_config_set "sieve_virustest_text_value2" "Presumed Clean"; +test_config_set "sieve_virustest_text_value3" "Not sure"; +test_config_set "sieve_virustest_text_value4" "Almost Certain"; +test_config_set "sieve_virustest_text_value5" "Definitely"; +test_config_reload :extension "virustest"; test "Text: 5" { if virustest :is "0" { @@ -45,8 +45,8 @@ test "Text: 5" { } } -test_config :set "sieve_virustest_status_header" "X-VirusCheck1"; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-VirusCheck1"; +test_config_reload :extension "virustest"; test "Text: 4" { if virustest :is "0" { @@ -59,8 +59,8 @@ test "Text: 4" { } } -test_config :set "sieve_virustest_status_header" "X-VirusCheck2"; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-VirusCheck2"; +test_config_reload :extension "virustest"; test "Text: 3" { if virustest :is "0" { @@ -73,8 +73,8 @@ test "Text: 3" { } } -test_config :set "sieve_virustest_status_header" "X-VirusCheck3"; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-VirusCheck3"; +test_config_reload :extension "virustest"; test "Text: 2" { if virustest :is "0" { @@ -87,8 +87,8 @@ test "Text: 2" { } } -test_config :set "sieve_virustest_status_header" "X-VirusCheck4"; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-VirusCheck4"; +test_config_reload :extension "virustest"; test "Text: 1" { if virustest :is "0" { @@ -101,11 +101,11 @@ test "Text: 1" { } } -test_config :set "sieve_virustest_status_header" "X-Virus-Scan:Found to be (.+)\."; -test_config :set "sieve_virustest_status_type" "text"; -test_config :set "sieve_virustest_text_value1" "clean"; -test_config :set "sieve_virustest_text_value5" "infected"; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-Virus-Scan:Found to be (.+)\."; +test_config_set "sieve_virustest_status_type" "text"; +test_config_set "sieve_virustest_text_value1" "clean"; +test_config_set "sieve_virustest_text_value5" "infected"; +test_config_reload :extension "virustest"; test "Text: regex: 1" { if virustest :is "0" { @@ -118,8 +118,8 @@ test "Text: regex: 1" { } } -test_config :set "sieve_virustest_status_header" "X-Virus-Scan1:Found to be (.+)\."; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-Virus-Scan1:Found to be (.+)\."; +test_config_reload :extension "virustest"; test "Text: regex: 5" { if virustest :is "0" { @@ -132,8 +132,8 @@ test "Text: regex: 5" { } } -test_config :set "sieve_virustest_status_header" "X-Virus-Scan2:Found to be (.+)\."; -test_config :reload "virustest"; +test_config_set "sieve_virustest_status_header" "X-Virus-Scan2:Found to be (.+)\."; +test_config_reload :extension "virustest"; test "Text: regex: 0" { if not virustest :is "0" { diff --git a/tests/extensions/subaddress/config.svtest b/tests/extensions/subaddress/config.svtest index 7145a079b3b0ea8328cb1407c029e5818ae6c357..d7c1cea463722954a6546898d2e4419491e50402 100644 --- a/tests/extensions/subaddress/config.svtest +++ b/tests/extensions/subaddress/config.svtest @@ -25,8 +25,8 @@ test "Delimiter default" { } test "Delimiter \"-\"" { - test_config :set "recipient_delimiter" "-"; - test_config :reload "subaddress"; + test_config_set "recipient_delimiter" "-"; + test_config_reload :extension "subaddress"; if not address :is :user "to" "test" { test_fail "wrong user part extracted"; @@ -38,8 +38,8 @@ test "Delimiter \"-\"" { } test "Delimiter \"++\"" { - test_config :set "recipient_delimiter" "++"; - test_config :reload "subaddress"; + test_config_set "recipient_delimiter" "++"; + test_config_reload :extension "subaddress"; if not envelope :is :user "to" "friep" { test_fail "wrong user part extracted"; @@ -51,8 +51,8 @@ test "Delimiter \"++\"" { } test "Delimiter \"--\"" { - test_config :set "recipient_delimiter" "--"; - test_config :reload "subaddress"; + test_config_set "recipient_delimiter" "--"; + test_config_reload :extension "subaddress"; if not envelope :is :user "from" "list" { test_fail "wrong user part extracted"; @@ -64,8 +64,8 @@ test "Delimiter \"--\"" { } test "Delimiter \"+-\"" { - test_config :set "recipient_delimiter" "+-"; - test_config :reload "subaddress"; + test_config_set "recipient_delimiter" "+-"; + test_config_reload :extension "subaddress"; if envelope :is :user "from" "list" { test_fail "user part extracted"; diff --git a/tests/extensions/vacation/execute.svtest b/tests/extensions/vacation/execute.svtest index 75c977a4169cbc4d1a94827f6b43d25321361d16..af91297259fafb047f0d7b28b5814b4173f02755 100644 --- a/tests/extensions/vacation/execute.svtest +++ b/tests/extensions/vacation/execute.svtest @@ -11,15 +11,15 @@ test "Action" { test_fail "script run failed"; } - if not test_result :count "eq" :comparator "i;ascii-numeric" "2" { + if not test_result_action :count "eq" :comparator "i;ascii-numeric" "2" { test_fail "invalid number of actions in result"; } - if not test_result :index 1 "vacation" { + if not test_result_action :index 1 "vacation" { test_fail "vacation action is not present as first item in result"; } - if not test_result :index 2 "keep" { + if not test_result_action :index 2 "keep" { test_fail "keep action is missing in result"; } diff --git a/tests/multiscript/basic.svtest b/tests/multiscript/basic.svtest index 0b59ff449e334f751b758eee4a4872aabf4fae8f..6e6e73ac70627dec6ec3a90275d42231f317e249 100644 --- a/tests/multiscript/basic.svtest +++ b/tests/multiscript/basic.svtest @@ -29,15 +29,15 @@ test "Append" { test_fail "failed to compile and run third script"; } - if not test_result :index 1 "store" { + if not test_result_action :index 1 "store" { test_fail "first action is not 'store'"; } - if not test_result :index 2 "vacation" { + if not test_result_action :index 2 "vacation" { test_fail "second action is not 'vacation'"; } - if not test_result :index 3 "notify" { + if not test_result_action :index 3 "notify" { test_fail "third action is not 'notify'"; } @@ -77,15 +77,15 @@ test "Sequential Execute" { test_fail "result execute failed after third script"; } - if not test_result :index 1 "store" { + if not test_result_action :index 1 "store" { test_fail "first action is not 'store'"; } - if not test_result :index 2 "vacation" { + if not test_result_action :index 2 "vacation" { test_fail "second action is not 'vacation'"; } - if not test_result :index 3 "notify" { + if not test_result_action :index 3 "notify" { test_fail "third action is not 'notify'"; } } diff --git a/tests/multiscript/conflicts.svtest b/tests/multiscript/conflicts.svtest index c501927778a2086c600d114e946cb323e6748eb3..208b666e578b65bd2c39ae76f482fe473262c35b 100644 --- a/tests/multiscript/conflicts.svtest +++ b/tests/multiscript/conflicts.svtest @@ -41,11 +41,11 @@ test "Graceful Conflicts" { test_fail "result execute failed after third script"; } - if not test_result :index 1 "store" { + if not test_result_action :index 1 "store" { test_fail "first action is not 'store'"; } - if test_result :index 2 "reject" { + if test_result_action :index 2 "reject" { test_fail "reject action not discarded"; } } @@ -83,11 +83,11 @@ test "Duplicates" { test_result_print; - if not test_result :index 1 "keep" { + if not test_result_action :index 1 "keep" { test_fail "first action is not 'keep'"; } - if test_result :index 2 "store" { + if test_result_action :index 2 "store" { test_fail "fileinto action not discarded"; } }