[dw-free] move cgi-bin/lj*.pl files into proper modules (in cgi-bin/LJ)
[commit: http://hg.dwscoalition.org/dw-free/rev/2cd10f6e1e66]
http://bugs.dwscoalition.org/show_bug.cgi?id=1726
Remove trailing whitespace from t/talklib-mail-migrate.t
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1726
Remove trailing whitespace from t/talklib-mail-migrate.t
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- t/talklib-mail-migrate.t
-------------------------------------------------------------------------------- diff -r 380ab9cde472 -r 2cd10f6e1e66 t/talklib-mail-migrate.t --- a/t/talklib-mail-migrate.t Wed Nov 02 18:47:35 2011 +0800 +++ b/t/talklib-mail-migrate.t Thu Nov 03 10:03:54 2011 -0500 @@ -62,7 +62,7 @@ next unless $targetu; foreach my $ispost (0, 1) { - my $parent = $ispost ? $entry : + my $parent = $ispost ? $entry : $entry->t_enter_comment ( u => temp_user(), subject => "A parent comment subject, w00t!", @@ -82,7 +82,7 @@ my $pic = undef; if ($commentu) { - + # reset this from where it was modified in a previous iteration delete $commentu->{defaultpicid}; @@ -101,17 +101,17 @@ } } - + # does the body contain html or no? - foreach my $bodytext + foreach my $bodytext ("OMG that Whitaker is pretty much awesome", "<h1>OMFGZ</h1> I'm so <i>excited</i> by this <a href='foo'><img src='img.gif'></a>") { - + foreach my $state (qw(A S)) { - + my $pic_kw = $picmode eq 'yes' ? 'foo' : undef; - + my $comment = $entry->t_enter_comment ( u => $commentu, subject => "A comment subject, w00t!", @@ -127,7 +127,7 @@ my $talkurl = $entry->url; # t_enter_comment returns a real comment object, - # which is actually pretty different from what + # which is actually pretty different from what # talklib looks for, bleh! $comment->{state} = $state; $comment->{u} = $commentu; @@ -138,32 +138,32 @@ $comment->{picture_keyword} = $pic_kw; $comment->{pic} = $pic_kw ? $pic : undef; $comment->{subjecticon} = $icon; - + if ($state eq 'S') { LJ::set_rel($targetu, $entryu, 'A'); } else { LJ::clear_rel($targetu, $entryu, 'S'); } - - my %senders = + + my %senders = ( html => [ sub { LJ::Talk::Post::format_html_mail - ($targetu, $parent, $comment, + ($targetu, $parent, $comment, "UTF-8", $talkurl, $entry) }, sub { $comment->format_html_mail(\%{$targetu}) }, ], - + text => [ sub { LJ::Talk::Post::format_text_mail - ($targetu, $parent, $comment, + ($targetu, $parent, $comment, $talkurl, $entry) }, sub { $comment->format_text_mail(\%{$targetu}) }, ], ); - + # initial iteration over text vs html email results foreach my $stype (sort keys %senders) { my ($smeth_old, $smeth_new) = @{$senders{$stype}}; - + # call this internal method to load the subject and body # members of the comment so that the old LJ::Talk APIs will # be able to access the members they expect @@ -172,13 +172,13 @@ foreach my $obj ($comment, $parent, $entry) { $obj->_load_text; } - + my $case_des = sub { - return + return "$stype, " . - "screened state=$state, " . + "screened state=$state, " . "parent ispost=$ispost, " . - ($targetu == $commentu ? "targetu=commentu" : + ($targetu == $commentu ? "targetu=commentu" : ($targetu == $entryu ? "targetu=entryu" : ($targetu == $otheru ? "targetu=otheru" : "targetu=unknown!") ) @@ -188,7 +188,7 @@ ($icon ? "icon=yes" : "icon=no") . ", " . "commentu=" . (ref $commentu ? "user" : "0"); }; - + my $old_rv = $smeth_old->(); my $new_rv = $smeth_new->(); my $des = $case_des->(); @@ -198,13 +198,13 @@ next if $eq; # sanity check that a userpic exists if we're in a userpic mode - if ($commentu && $stype eq 'html' && - ($picmode eq 'yes' || $picmode eq 'default')) + if ($commentu && $stype eq 'html' && + ($picmode eq 'yes' || $picmode eq 'default')) { unless ($old_rv =~ /$LJ::USERPIC_ROOT/ && $new_rv =~ /$LJ::USERPIC_ROOT/) { - print + print "Unexpected output: picmode=$picmode, but " . "$LJ::USERPIC_ROOT not present? [$des]\n"; } @@ -213,16 +213,16 @@ # sanity check that a subjecticon exists if we're testing for one if ($icon && $stype eq 'html') { unless ($old_rv =~ /$icon/ && $new_rv =~ /$icon/) { - print - "Unexpected output: icon=$icon, but not " . + print + "Unexpected output: icon=$icon, but not " . "present? [$des]\n"; } } - + # otherwise warn with a diff if Text::Diff is installed and someone # is debugging this code... uncomment the next block to see useful # failure info. - + #print ("="x80) . "\n$des\n\n"; # #use Text::Diff; --------------------------------------------------------------------------------