1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
require "vnd.dovecot.testsuite";
require "relational";
require "comparator-i;ascii-numeric";
/*
* Generic include errors
*/
test "Generic" {
if test_script_compile "errors/generic.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "3" {
test_fail "wrong number of errors reported";
}
}
test "Circular - direct" {
if test_script_compile "errors/circular-1.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "3" {
test_fail "wrong number of errors reported";
}
}
test "Circular - one intermittent" {
if test_script_compile "errors/circular-2.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "4" {
test_fail "wrong number of errors reported";
}
}
test "Circular - two intermittent" {
if test_script_compile "errors/circular-3.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "5" {
test_fail "wrong number of errors reported";
}
}
/*
* Using global without variables required
*/
test "Variables inactive" {
if test_script_compile "errors/variables-inactive.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "3" {
test_fail "wrong number of errors reported";
}
}
/*
* Generic variables errors
*/
test "Variables" {
if test_script_compile "errors/variables.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "3" {
test_fail "wrong number of errors reported";
}
}
/*
* Global variable namespace
*/
test "Global Namespace" {
if test_script_compile "errors/global-namespace.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "4" {
test_fail "wrong number of errors reported";
}
}
/*
* Invalid script names
*/
test "Invalid Script Names" {
if test_script_compile "errors/scriptname.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "8" {
test_fail "wrong number of errors reported";
}
}
/* Include limit */
test "Include limit" {
test_config_set "sieve_include_max_includes" "3";
test_config_reload :extension "include";
if test_script_compile "errors/include-limit.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "2" {
test_fail "wrong number of errors reported";
}
test_config_set "sieve_include_max_includes" "255";
test_config_reload :extension "include";
if not test_script_compile "errors/include-limit.sieve" {
test_fail "compile should have succeeded";
}
}
/* Depth limit */
test "Depth limit" {
test_config_set "sieve_include_max_nesting_depth" "2";
test_config_reload :extension "include";
if test_script_compile "errors/depth-limit.sieve" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "4" {
test_fail "wrong number of errors reported";
}
test_config_set "sieve_include_max_nesting_depth" "10";
test_config_reload :extension "include";
if not test_script_compile "errors/depth-limit.sieve" {
test_fail "compile should have succeeded";
}
}
|