[swiftsieve] [PATCH] Add a test for App::Swiftsieve::Util.

Vsevolod Kozlov zaba at thorium.homeunix.org
Sun Mar 1 16:26:01 UTC 2009


---
 t/sieve-util.t |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 t/sieve-util.t

diff --git a/t/sieve-util.t b/t/sieve-util.t
new file mode 100644
index 0000000..1779e4b
--- /dev/null
+++ b/t/sieve-util.t
@@ -0,0 +1,28 @@
+# © 2009 Vsevolod Kozlov <zaba at thorium.homeunix.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, you can find it at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+
+use_ok('App::Swiftsieve::Util', qw(sieve_escape sieve_unescape allowed_value));
+
+my $string = '"foo bar\n"';
+is(sieve_escape($string), '\"foo bar\\\n\"', "string is escaped correctly");
+is($string, sieve_unescape(sieve_escape($string)), "escaped string is unescaped correctly");
+
+is(allowed_value("foo",[qw(foo bar baz)]), "foo", "allowed_value works when the value is allowed");
+ok(!defined(allowed_value("qux",[qw(foo bar baz)])), "allowed_value works when the value is not allowed");
-- 
1.6.0.6




More information about the Swiftsieve-devel mailing list