[Cpan-forum-commit] rev 211 - in trunk: lib/CPAN/Forum t/markup

svn at pti.co.il svn at pti.co.il
Wed Aug 30 12:56:17 IDT 2006


Author: gabor
Date: 2006-08-30 12:56:17 +0300 (Wed, 30 Aug 2006)
New Revision: 211

Modified:
   trunk/lib/CPAN/Forum/Markup.pm
   trunk/t/markup/010-markup.t
Log:
add TODO tests for testing the linke breaking mechanism of the Markup.pm


Modified: trunk/lib/CPAN/Forum/Markup.pm
===================================================================
--- trunk/lib/CPAN/Forum/Markup.pm	2006-08-30 09:35:58 UTC (rev 210)
+++ trunk/lib/CPAN/Forum/Markup.pm	2006-08-30 09:56:17 UTC (rev 211)
@@ -70,7 +70,17 @@
 }
 
 
+my $NEXTMARK = '<span class="nextmark">+</span>';
 
+sub get_nextmark {
+    return $NEXTMARK;
+}
+sub set_nextmark {
+    die 'This internal functiom needs 2 paramters' if @_ != 2;
+    $NEXTMARK = pop @_;
+    return $NEXTMARK;
+}
+
 =head2 split_rows
 
 Takes a string and a number N.
@@ -82,7 +92,7 @@
 sub split_rows {
     my ($text, $N) = @_;
     $N ||= 100;
-    my $NEXTMARK = '<span class="nextmark">+</span>';
+    my $NEXTMARK = __PACKAGE__->get_nextmark();
 
     my @text = split /\n/, $text;
     my @new;

Modified: trunk/t/markup/010-markup.t
===================================================================
--- trunk/t/markup/010-markup.t	2006-08-30 09:35:58 UTC (rev 210)
+++ trunk/t/markup/010-markup.t	2006-08-30 09:56:17 UTC (rev 211)
@@ -10,11 +10,6 @@
 use lib "blib/lib";
 use CPAN::Forum::Markup;
 
-my $long = "x234567890" x 6 . "qwertyuiop" x 4;
-my $long_new = "x234567890" x 6 . "\n" . "+" . "qwertyuiop" x 4;
-my $long2 = "x234567890" x 10 . "abcdef" x 20;
-my $long2_new = "x234567890" x 6 . "\n" . "+" . "1234567890" x 4 . "\n" . "+" . "abcdef" x 13 . "\n" . "+" . "abcdef" x 7;
-
 my $TEXT = '<div class="text">';
 my $END  = '</div>';
 my $CODE = '<div class="code">';
@@ -86,12 +81,20 @@
 );
 
 
-plan tests => 1 + (2 * keys %cases) + (1 * keys %fails) + (2 * 3);
+plan tests => 6 + (2 * keys %cases) + (1 * keys %fails) + (2 * 3);
 
-is(CPAN::Forum::Markup::split_rows("some text", 60), "some text");
-#is(CPAN::Forum::Markup::split_rows($long, 61), $long_new);
-#is(CPAN::Forum::Markup::split_rows($long2, 61), $long2_new);
+is(CPAN::Forum::Markup->get_nextmark(), '<span class="nextmark">+</span>');
+is(CPAN::Forum::Markup->set_nextmark('|'), '|');
+is(CPAN::Forum::Markup->get_nextmark(), '|');
 
+is(CPAN::Forum::Markup::split_rows('some text', 60), 'some text');
+
+TODO: {
+    local $TODO = 'fix split_rows';
+    is(CPAN::Forum::Markup::split_rows('some text with more content', 10), "some text\n|with more\n|content");
+    is(CPAN::Forum::Markup::split_rows('some text with morecontent', 10), "some text\n|with\n|morecontent");
+}
+
 my $markup = CPAN::Forum::Markup->new();
 
 



More information about the Cpan-forum-commit mailing list