Skip to content

Commit

Permalink
r32110@knight: rjbs | 2007-07-18 21:07:09 -0400
Browse files Browse the repository at this point in the history
 make stupid tests less stupid
  • Loading branch information
rjbs committed Jul 19, 2007
1 parent 634ab66 commit fe56079
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 214 deletions.
3 changes: 1 addition & 2 deletions MANIFEST
Expand Up @@ -8,8 +8,7 @@ lib/Email/Abstract/MIMEEntity.pm
Makefile.PL
MANIFEST This list of files
README
t/abs-object.t
t/classy.t
t/abstractions.t
t/lib/Test/EmailAbstract.pm
t/pod.t
t/pod-coverage.t
Expand Down
2 changes: 1 addition & 1 deletion lib/Email/Abstract/MailInternet.pm
Expand Up @@ -13,7 +13,7 @@ sub get_header {
my @values = $obj->head->get($header);

# No reason to s/// lots of values if we're just going to return one.
$#values = 1 if not wantarray;
$#values = 0 if not wantarray;

chomp @values;
s/(?:\x0d\x0a|\x0a\x0d|\x0a|\x0d)\s+/ /g for @values;
Expand Down
75 changes: 19 additions & 56 deletions t/abs-object.t
Expand Up @@ -10,12 +10,15 @@ my @classes
= qw(Email::MIME Email::Simple MIME::Entity Mail::Internet Mail::Message);

plan tests => 2
+ (@classes + 2) * Test::EmailAbstract->tests_per_obj
+ (@classes + 1) * Test::EmailAbstract->tests_per_object
+ (@classes + 1) * Test::EmailAbstract->tests_per_class
+ 1;

use_ok("Email::Abstract");

my $message = do { local $/; <DATA>; };
open FILE, '<t/example.msg';
my $message = do { local $/; <FILE>; };
close FILE;

# Let's be generous and start with real CRLF, no matter what stupid thing the
# VCS or archive tools have done to the message.
Expand All @@ -31,74 +34,34 @@ is(

for my $class (@classes) {
SKIP: {
eval "require $class";
skip "$class can't be loaded", $tester->tests_per_obj if $@;

my $obj = Email::Abstract->cast($message, $class);

my $email_abs = Email::Abstract->new($obj);

$tester->wrapped_ok($class, $email_abs, 0);
$tester->load($class);

{
my $obj = Email::Abstract->cast($message, $class);
my $email_abs = Email::Abstract->new($obj);
$tester->object_ok($class, $email_abs, 0);
}

{
my $obj = Email::Abstract->cast($message, $class);
$tester->class_ok($class, $obj, 0);
}
}
}

{
my $email_abs = Email::Abstract->new($message);
$tester->wrapped_ok('plaintext', $email_abs, 0);
$tester->object_ok('plaintext', $email_abs, 0);
$tester->class_ok('plaintext (class)', $message, 1);
}

{
# Ensure that we can use Email::Abstract->header($abstract, 'foo')
my $email_abs = Email::Abstract->new($message);
$tester->class_ok('plaintext (via class)', $email_abs, 0);

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",
);
}

__DATA__
Received: from mailman.opengroup.org ([192.153.166.9])
by deep-dark-truthful-mirror.pad with smtp (Exim 3.36 #1 (Debian))
id 18Buh5-0006Zr-00
for <posix@simon-cozens.org>; Wed, 13 Nov 2002 10:24:23 +0000
Received: (qmail 1679 invoked by uid 503); 13 Nov 2002 10:10:49 -0000
Resent-Date: 13 Nov 2002 10:10:49 -0000
Date: Wed, 13 Nov 2002 10:06:51 GMT
From: Andrew Josey <ajosey@rdg.opengroup.org>
Message-Id: <1021113100650.ZM12997@skye.rdg.opengroup.org>
In-Reply-To: Joanna Farley's message as of Nov 13, 9:56am.
References: <200211120937.JAA28130@xoneweb.opengroup.org>
<1021112125524.ZM7503@skye.rdg.opengroup.org>
<3DD221BB.13116D47@sun.com>
X-Mailer: Z-Mail (5.0.0 30July97)
To: austin-group-l@opengroup.org
Subject: Re: Defect in XBD lround
MIME-Version: 1.0
Resent-Message-ID: <gZGK1B.A.uY.iUi09@mailman>
Resent-To: austin-group-l@opengroup.org
Resent-From: austin-group-l@opengroup.org
X-Mailing-List: austin-group-l:archive/latest/4823
X-Loop: austin-group-l@opengroup.org
Precedence: list
X-Spam-Status: No, hits=-1.6 required=5.0
Resent-Sender: austin-group-l-request@opengroup.org
Content-Type: text/plain; charset=us-ascii
Joanna, All
Thanks. I got the following response from Fred Tydeman.
On Nov 13, 9:56am in "Re: Defect in XBD lr", Joanna Farley wrote:
> Sun's expert in this area after some discussions with a colleague
> outside of Sun concluded that for lround, to align with both C99 and SUS
> changes of the following form were necessary:
> this line of text is really long and no one need worry about it but why was such a long text chosen to begin with i mean really??
-----
Andrew Josey The Open Group
Austin Group Chair Apex Plaza,Forbury Road,
Email: a.josey@opengroup.org Reading,Berks.RG1 1AX,England
Tel: +44 118 9508311 ext 2250 Fax: +44 118 9500110
138 changes: 0 additions & 138 deletions t/classy.t

This file was deleted.

42 changes: 42 additions & 0 deletions t/example.msg
@@ -0,0 +1,42 @@
Received: from mailman.opengroup.org ([192.153.166.9])
by deep-dark-truthful-mirror.pad with smtp (Exim 3.36 #1 (Debian))
id 18Buh5-0006Zr-00
for <posix@simon-cozens.org>; Wed, 13 Nov 2002 10:24:23 +0000
Received: (qmail 1679 invoked by uid 503); 13 Nov 2002 10:10:49 -0000
Resent-Date: 13 Nov 2002 10:10:49 -0000
Date: Wed, 13 Nov 2002 10:06:51 GMT
From: Andrew Josey <ajosey@rdg.opengroup.org>
Message-Id: <1021113100650.ZM12997@skye.rdg.opengroup.org>
In-Reply-To: Joanna Farley's message as of Nov 13, 9:56am.
References: <200211120937.JAA28130@xoneweb.opengroup.org>
<1021112125524.ZM7503@skye.rdg.opengroup.org>
<3DD221BB.13116D47@sun.com>
X-Mailer: Z-Mail (5.0.0 30July97)
To: austin-group-l@opengroup.org
Subject: Re: Defect in XBD lround
MIME-Version: 1.0
Resent-Message-ID: <gZGK1B.A.uY.iUi09@mailman>
Resent-To: austin-group-l@opengroup.org
Resent-From: austin-group-l@opengroup.org
X-Mailing-List: austin-group-l:archive/latest/4823
X-Loop: austin-group-l@opengroup.org
Precedence: list
X-Spam-Status: No, hits=-1.6 required=5.0
Resent-Sender: austin-group-l-request@opengroup.org
Content-Type: text/plain; charset=us-ascii

Joanna, All

Thanks. I got the following response from Fred Tydeman.

On Nov 13, 9:56am in "Re: Defect in XBD lr", Joanna Farley wrote:
> Sun's expert in this area after some discussions with a colleague
> outside of Sun concluded that for lround, to align with both C99 and SUS
> changes of the following form were necessary:
> this line of text is really long and no one need worry about it but why was such a long text chosen to begin with i mean really??

-----
Andrew Josey The Open Group
Austin Group Chair Apex Plaza,Forbury Road,
Email: a.josey@opengroup.org Reading,Berks.RG1 1AX,England
Tel: +44 118 9508311 ext 2250 Fax: +44 118 9500110

0 comments on commit fe56079

Please sign in to comment.