aboutsummaryrefslogtreecommitdiff
path: root/t/yesno.t
diff options
context:
space:
mode:
Diffstat (limited to 't/yesno.t')
-rwxr-xr-xt/yesno.t21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/yesno.t b/t/yesno.t
new file mode 100755
index 000000000..60a8c071d
--- /dev/null
+++ b/t/yesno.t
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More tests => 10;
+
+BEGIN { use_ok("IkiWiki"); }
+
+# note: yesno always accepts English even if localized.
+# So no need to bother setting locale to C.
+
+ok(IkiWiki::yesno("yes") == 1);
+ok(IkiWiki::yesno("Yes") == 1);
+ok(IkiWiki::yesno("YES") == 1);
+
+ok(IkiWiki::yesno("no") == 0);
+ok(IkiWiki::yesno("No") == 0);
+ok(IkiWiki::yesno("NO") == 0);
+
+ok(IkiWiki::yesno("1") == 1);
+ok(IkiWiki::yesno("0") == 0);
+ok(IkiWiki::yesno("mooooooooooo") == 0);