summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRicardo SIGNES <rjbs@cpan.org>2008-12-09 00:06:12 -0500
committerRicardo SIGNES <rjbs@cpan.org>2008-12-09 00:06:12 -0500
commitf87f0920124d97ccea13987c0db0701f6f763590 (patch)
tree1c6e11f3ae51447cb2d750e0c942407c8fccec5a /t
parent9f978c44062471d3010933e45f599bb0201e8d76 (diff)
allow ->new(\\$ref)
Diffstat (limited to 't')
-rw-r--r--t/abstractions.t47
1 files changed, 27 insertions, 20 deletions
diff --git a/t/abstractions.t b/t/abstractions.t
index 9d97f6f..6e61b33 100644
--- a/t/abstractions.t
+++ b/t/abstractions.t
@@ -10,9 +10,9 @@ my @classes
= qw(Email::MIME Email::Simple MIME::Entity Mail::Internet Mail::Message);
plan tests => 2
- + (@classes * 2 + 1) * Test::EmailAbstract->tests_per_object
- + (@classes + 2) * Test::EmailAbstract->tests_per_class
- + 1;
+ + (@classes * 2 + 2) * Test::EmailAbstract->tests_per_object
+ + (@classes + 4) * Test::EmailAbstract->tests_per_class
+ + 2;
use_ok("Email::Abstract");
@@ -56,24 +56,31 @@ for my $class (@classes) {
}
}
-{
- my $email_abs = Email::Abstract->new($message);
- $tester->object_ok('plaintext', $email_abs, 0);
- $tester->class_ok('plaintext (class)', $message, 1);
-}
+for my $ref (0..1) {
+ my $get_msg = $ref
+ ? sub { my $copy = $message; \$copy }
+ : sub { $message };
+ my $desc = 'plaintext' . ($ref ? ' (ref)' : '');
-{
- my $email_abs = Email::Abstract->new($message);
- $tester->class_ok('Email::Abstract', $email_abs, 0);
-}
+ {
+ my $email_abs = Email::Abstract->new($get_msg->());
+ $tester->object_ok($desc, $email_abs, 0);
+ $tester->class_ok("$desc (class)", $get_msg->(), 1);
+ }
-{
- # Ensure that we can use Email::Abstract->header($abstract, 'foo')
- my $email_abs = Email::Abstract->new($message);
+ {
+ my $email_abs = Email::Abstract->new($get_msg->());
+ $tester->class_ok('Email::Abstract', $email_abs, 0);
+ }
+
+ {
+ # Ensure that we can use Email::Abstract->header($abstract, 'foo')
+ my $email_abs = Email::Abstract->new($get_msg->());
- my $email_abs_new = Email::Abstract->new($email_abs);
- ok(
- $email_abs == $email_abs_new,
- "trying to wrap a wrapper returns the wrapper; it doesn't re-wrap",
- );
+ my $email_abs_new = Email::Abstract->new($email_abs);
+ ok(
+ $email_abs == $email_abs_new,
+ "trying to wrap a wrapper returns the wrapper; it doesn't re-wrap",
+ );
+ }
}