[libmixin-extrafields-param-perl] 16/25: r20944 at knave: rjbs | 2006-04-12 23:01:23 -0400 test for multiple imports
Florian Schlichting
fsfs at moszumanska.debian.org
Wed Jan 29 21:00:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
fsfs pushed a commit to annotated tag 0.001
in repository libmixin-extrafields-param-perl.
commit 499b1452135797d9ebff40f379ac4c19999f72ef
Author: Ricardo SIGNES <rjbs at codesimply.com>
Date: Thu Apr 13 15:32:38 2006 +0000
r20944 at knave: rjbs | 2006-04-12 23:01:23 -0400
test for multiple imports
---
t/multi.t | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/t/multi.t b/t/multi.t
new file mode 100644
index 0000000..b15fd70
--- /dev/null
+++ b/t/multi.t
@@ -0,0 +1,84 @@
+#!perl -T
+use strict;
+use warnings;
+
+use Test::More tests => 15;
+
+{
+ package Widget::Parameterized;
+ use Mixin::Param
+ -param => undef,
+ -param => { noun => 'field' },
+ ;
+
+ sub new { bless {} => shift; }
+}
+
+my $widget = Widget::Parameterized->new;
+
+isa_ok($widget, 'Widget::Parameterized');
+can_ok($widget, 'param');
+can_ok($widget, 'field');
+
+{
+ my @names = $widget->param;
+ cmp_ok(@names, '==', 0, "there are zero params to start with");
+
+ my @names_fields = $widget->field;
+ cmp_ok(@names_fields, '==', 0, "there are zero params_fields to start with");
+}
+
+is(
+ $widget->param('flavor'),
+ undef,
+ "a specific param is also unset",
+);
+
+{
+ my @names = $widget->param;
+ cmp_ok(@names, '==', 0, "checking on a given param didn't create it");
+}
+
+is(
+ $widget->param(flavor => 'teaberry'),
+ 'teaberry',
+ "we set a param and got its value back",
+);
+
+is(
+ $widget->param('flavor'),
+ 'teaberry',
+ "...and that value stuck",
+);
+
+is(
+ $widget->field('flavor'),
+ undef,
+ "...but it didn't affect the same-name field",
+);
+
+{
+ my @names = $widget->param;
+ cmp_ok(@names, '==', 1, "so now there is one param");
+
+ my @names_fields = $widget->field;
+ cmp_ok(@names_fields, '==', 0, "but still zero fields");
+}
+
+is(
+ $widget->field(flavor => 'canadamint'),
+ 'canadamint',
+ "we set a field and got its value back",
+);
+
+is(
+ $widget->field('flavor'),
+ 'canadamint',
+ "...and that value stuck",
+);
+
+is(
+ $widget->param('flavor'),
+ 'teaberry',
+ "...but it didn't affect the same-name param",
+);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmixin-extrafields-param-perl.git
More information about the Pkg-perl-cvs-commits
mailing list