From 322597a893f14936989112f5da39a2275830dea9 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Sat, 1 Aug 2009 22:33:37 +0200
Subject: [PATCH] Testsuite: added tests for the mailbox extension.

---
 Makefile.am                             |  1 +
 tests/extensions/mailbox/execute.svtest | 48 +++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 tests/extensions/mailbox/execute.svtest

diff --git a/Makefile.am b/Makefile.am
index 9657a4de4..3e0005334 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -88,6 +88,7 @@ test_cases = \
 	tests/extensions/enotify/mailto.svtest \
 	tests/extensions/environment/basic.svtest \
 	tests/extensions/environment/rfc.svtest \
+	tests/extensions/mailbox/execute.svtest \
 	tests/multiscript/basic.svtest \
 	tests/deprecated/notify/basic.svtest \
 	tests/deprecated/notify/mailto.svtest \
diff --git a/tests/extensions/mailbox/execute.svtest b/tests/extensions/mailbox/execute.svtest
new file mode 100644
index 000000000..22c0d0f29
--- /dev/null
+++ b/tests/extensions/mailbox/execute.svtest
@@ -0,0 +1,48 @@
+require "vnd.dovecot.testsuite";
+require "mailbox";
+require "fileinto";
+
+test "MailboxExists - None exist" {
+	if mailboxexists "frop" {
+		test_fail "mailboxexists confirms existance of unknown folder";
+	}
+}
+
+test_mailbox :create "frop";
+test_mailbox :create "friep";
+
+test "MailboxExists - Not all exist" {
+	if mailboxexists ["frop", "friep", "frml"] {
+		test_fail "mailboxexists confirms existance of unknown folder";
+	}
+}
+
+test_mailbox :create "frml";
+
+test "MailboxExists - One exists" {
+	if not mailboxexists ["frop"] {
+		test_fail "mailboxexists fails to recognize folder";
+	}
+}
+
+test "MailboxExists - All exist" {
+	if not mailboxexists ["frop", "friep", "frml"] {
+		test_fail "mailboxexists fails to recognize folders";
+	}
+}
+
+test ":Create" {
+	if mailboxexists "created" {
+		test_fail "mailbox exists already";
+	}
+
+	fileinto :create "created";
+
+	if not test_result_execute {
+		test_fail "execution of result failed";
+	}
+
+	if not mailboxexists "created" {
+		test_fail "mailbox somehow not created";
+	}
+}
-- 
GitLab