require "vnd.dovecot.testsuite";
require "variables";
require "vnd.dovecot.debug";

require "relational";
require "comparator-i;ascii-numeric";

/*
 * Invalid syntax
 */

test "Invalid Syntax" {
	if test_script_compile "errors/syntax.sieve" {
		test_fail "compile should have failed";
	}

	# FIXME: check warnings
	if not test_error :count "eq" :comparator "i;ascii-numeric" "12" {
		test_fail "wrong number of errors reported";
	}
}

/*
 * Mailboxexists - bad UTF-8 in mailbox name
 */

test "Mailboxexists - bad UTF-8 in mailbox name" {
	if not test_script_compile "errors/mailboxexists-bad-utf8.sieve" {
		test_fail "compile failed";
	}

	if not test_script_run {
		test_fail "execution failed";
	}

	# FIXME: check warnings
	if not test_error :count "eq" :comparator "i;ascii-numeric" "0" {
		test_fail "wrong number of runtime errors reported";
	}
}
