[libtype-tiny-perl] 08/27: tests for dicts containing Maybe and Bool (some fails)
Jonas Smedegaard
js at alioth.debian.org
Fri Aug 9 21:13:10 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libtype-tiny-perl.
commit d6a9349b1d3d240c34f6f009832bc3ef6072f3cb
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date: Wed Jul 31 08:28:02 2013 +0100
tests for dicts containing Maybe and Bool (some fails)
---
t/stdlib-structures.t | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/t/stdlib-structures.t b/t/stdlib-structures.t
index 16d550c..73cc585 100644
--- a/t/stdlib-structures.t
+++ b/t/stdlib-structures.t
@@ -94,4 +94,17 @@ should_pass([ [] ], $slurper);
should_fail([ [], 1.1 => 1, xxx => 2 ], $slurper);
should_fail([ [], 1.1 => 1, 2.1 => undef ], $slurper);
+my $struct5 = Dict[ i => Maybe[Int], b => Bool ];
+should_pass({ i => 42, b => undef }, $struct5);
+should_pass({ i => 42, b => '' }, $struct5);
+should_pass({ i => 42, b => 0 }, $struct5);
+should_pass({ i => 42, b => 1 }, $struct5);
+should_pass({ i => undef, b => 1 }, $struct5);
+should_fail({ b => 42, i => 1 }, $struct5);
+should_fail({ i => 42 }, $struct5);
+should_fail({ b => 1 }, $struct5);
+should_fail({ i => 42, b => 1, a => 1 }, $struct5);
+should_fail({ i => 42, a => 1 }, $struct5);
+should_fail({ a => 42, b => 1 }, $struct5);
+
done_testing;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtype-tiny-perl.git
More information about the Pkg-perl-cvs-commits
mailing list