Improve capabilities list handling in parser tests

pull/24/merge
Aleksander Machniak 12 years ago
parent e3dd1b7739
commit 7641e4aaab

@ -15,7 +15,15 @@ class Parser extends PHPUnit_Framework_TestCase
*/
function test_parser($input, $output, $message)
{
$script = new rcube_sieve_script($input);
// get capabilities list from the script
$caps = array();
if (preg_match('/require \[([a-z0-9", ]+)\]/', $input, $m)) {
foreach (explode(',', $m[1]) as $cap) {
$caps[] = trim($cap, '" ');
}
}
$script = new rcube_sieve_script($input, $caps);
$result = $script->as_text();
$this->assertEquals(trim($result), trim($output), $message);

Loading…
Cancel
Save