[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7624] paragraph.t no method call syntax
From: |
gavinsmith0123 |
Subject: |
[7624] paragraph.t no method call syntax |
Date: |
Fri, 13 Jan 2017 16:13:30 -0500 (EST) |
Revision: 7624
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7624
Author: gavin
Date: 2017-01-13 16:13:30 -0500 (Fri, 13 Jan 2017)
Log Message:
-----------
paragraph.t no method call syntax
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/t/paragraph.t
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2017-01-13 20:49:10 UTC (rev 7623)
+++ trunk/ChangeLog 2017-01-13 21:13:30 UTC (rev 7624)
@@ -1,5 +1,12 @@
2017-01-13 Gavin Smith <address@hidden>
+ * tp/t/paragraph.t: Avoid using method call syntax to call
+ subroutines in Texinfo::Convert::Paragraph. Only run each test
+ once. Remove tests using 'lines_counter' value on paragraph
+ hash.
+
+2017-01-13 Gavin Smith <address@hidden>
+
* tp/Texinfo/Convert/Plaintext.pm: Remove remaining usage
of method call syntax when calling subroutines in the
Texinfo::Convert::Paragraph module.
Modified: trunk/tp/t/paragraph.t
===================================================================
--- trunk/tp/t/paragraph.t 2017-01-13 20:49:10 UTC (rev 7623)
+++ trunk/tp/t/paragraph.t 2017-01-13 21:13:30 UTC (rev 7624)
@@ -6,9 +6,7 @@
BEGIN {
-# X * 2 - Y: X is the total number of tests, Y the number of tests only to
-# be run once.
-plan tests => 122 * 2 - 37;
+plan tests => 119;
my ($real_command_name, $command_directory, $command_suffix)
= fileparse($0, '.t');
@@ -23,18 +21,20 @@
}; # end BEGIN
-use Texinfo::Convert::ParagraphNonXS;
use Texinfo::Convert::Paragraph;
+
+*add_text = \&Texinfo::Convert::Paragraph::add_text;
+*add_next = \&Texinfo::Convert::Paragraph::add_next;
+*set_space_protection = \&Texinfo::Convert::Paragraph::set_space_protection;
+*remove_end_sentence = \&Texinfo::Convert::Paragraph::remove_end_sentence;
+*allow_end_sentence = \&Texinfo::Convert::Paragraph::allow_end_sentence;
+*add_end_sentence = \&Texinfo::Convert::Paragraph::add_end_sentence;
+*end_line = \&Texinfo::Convert::Paragraph::end_line;
+*add_pending_word = \&Texinfo::Convert::Paragraph::add_pending_word;
+
use Texinfo::Convert::Line;
use Texinfo::Convert::UnFilled;
-# We do the paragraph module tests twice, once with the XS module, once with
-# the non-XS module. A few them are only done once, though.
-
-my $paragraph_module = "Texinfo::Convert::ParagraphNonXS";
-
-my $testing_XSParagraph;
-DOITAGAIN:
ok(1, "modules loading"); # If we made it this far, we're ok.
sub test_para($$$;$)
@@ -47,11 +47,11 @@
my $result = '';
#$conf = {'DEBUG' => 1} if (!defined($conf));
$conf = {} if (!defined($conf));
- my $para = $paragraph_module->new($conf);
+ my $para = Texinfo::Convert::Paragraph->new($conf);
foreach my $arg (@$args) {
- $result .= $para->add_text($arg);
+ $result .= add_text($para, $arg);
}
- $result .= $para->end();
+ $result .= Texinfo::Convert::Paragraph::end($para);
if (defined($reference)) {
is ($result, $reference, $name);
} else {
@@ -153,374 +153,361 @@
"counter_and_line", {'counter' => 60});
-my $para = $paragraph_module->new();
+my $para = Texinfo::Convert::Paragraph->new();
my $result = '';
-$result .= $para->add_text('aa.)');
-$result .= $para->add_next('_');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+$result .= add_next($para, '_');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.)_ after\n", 'add char after end sentence parentheses');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('b ');
-$result .= $para->add_next('_');
-$result .= $para->add_text('.');
-$result .= $para->add_next('_');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'b ');
+$result .= add_next($para, '_');
+$result .= add_text($para, '.');
+$result .= add_next($para, '_');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "b _._ after\n", 'add char after end sentence');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_next('a');
-$result .= $para->add_next("\n");
-$result .= $para->add_next('_');
-$result .= $para->end();
+$result .= add_next($para, 'a');
+$result .= add_next($para, "\n");
+$result .= add_next($para, '_');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "a\n_\n", 'add_next: add char after separate end line');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_next("a\n");
-$result .= $para->add_next('_');
-$result .= $para->end();
+$result .= add_next($para, "a\n");
+$result .= add_next($para, '_');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "a\n_\n", 'add_next: add char after end line');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text("A");
-$result .= $para->add_next('_');
-$result .= $para->add_text(".)");
-$result .= $para->add_text(" Next");
-$result .= $para->end();
+$result .= add_text($para, "A");
+$result .= add_next($para, '_');
+$result .= add_text($para, ".)");
+$result .= add_text($para, " Next");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "A_.) Next\n", 'add_next: period after next, not transparent');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text("A");
-$result .= $para->add_next('_', 1);
-$result .= $para->add_text(".)");
-$result .= $para->add_text(" Next");
-$result .= $para->end();
+$result .= add_text($para, "A");
+$result .= add_next($para, '_', 1);
+$result .= add_text($para, ".)");
+$result .= add_text($para, " Next");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "A_.) Next\n", 'add_next: period after next, transparent');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text("aa.\n");
-$result .= $para->set_space_protection(undef,undef,undef,1);
-$result .= $para->add_next('_');
-$result .= $para->add_text("b");
-$result .= $para->end();
+$result .= add_text($para, "aa.\n");
+$result .= set_space_protection($para, undef,undef,undef,1);
+$result .= add_next($para, '_');
+$result .= add_text($para, "b");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa. _b\n", 'add char after space protection end sentence
space');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->set_space_protection(undef,undef,undef,1);
-$result .= $para->add_text("b");
-$result .= $para->set_space_protection(undef,undef,undef,0);
-$result .= $para->add_text(". after");
-$result .= $para->end();
+$result .= set_space_protection($para, undef,undef,undef,1);
+$result .= add_text($para, "b");
+$result .= set_space_protection($para, undef,undef,undef,0);
+$result .= add_text($para, ". after");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "b. after\n", 'punctuation after end space protection');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->set_space_protection(undef,undef,undef,1);
-$result .= $para->add_text("b.");
-$result .= $para->set_space_protection(undef,undef,undef,0);
-$result .= $para->add_text(" follow");
-$result .= $para->end();
+$result .= set_space_protection($para, undef,undef,undef,1);
+$result .= add_text($para, "b.");
+$result .= set_space_protection($para, undef,undef,undef,0);
+$result .= add_text($para, " follow");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "b. follow\n", 'punctuation before end space protection');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->set_space_protection(undef,undef,undef,1);
-$result .= $para->add_text("b.");
-$result .= $para->set_space_protection(undef,undef,undef,0);
-$result .= $para->add_text(" follow");
-$result .= $para->end();
+$result .= set_space_protection($para, undef,undef,undef,1);
+$result .= add_text($para, "b.");
+$result .= set_space_protection($para, undef,undef,undef,0);
+$result .= add_text($para, " follow");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "b. follow\n", 'punctuation before end space protection 2 space');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->set_space_protection(undef,undef,undef,1);
-$result .= $para->add_text("b. ");
-$result .= $para->set_space_protection(undef,undef,undef,0);
-$result .= $para->add_text(" follow");
-$result .= $para->end();
+$result .= set_space_protection($para, undef,undef,undef,1);
+$result .= add_text($para, "b. ");
+$result .= set_space_protection($para, undef,undef,undef,0);
+$result .= add_text($para, " follow");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "b. follow\n", 'punctuation space before end space protection');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text("In w:\n");
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text("Out of code -- out-of-code.
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg");
-$result .= $para->end();
+$result .= add_text($para, "In w:\n");
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, "Out of code -- out-of-code.
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "In w: Out of code -- out-of-code.
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\n", 'space
protection after end sentence');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text("In w:\n");
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text("Out of code -- out-of-code.");
-$result .= $para->set_space_protection(undef,undef,undef,1);
-$result .= $para->add_text("in code");
-$result .= $para->end();
+$result .= add_text($para, "In w:\n");
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, "Out of code -- out-of-code.");
+$result .= set_space_protection($para, undef,undef,undef,1);
+$result .= add_text($para, "in code");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "In w: Out of code -- out-of-code.in code\n", 'set frenchspacing
after space protection');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text("a ");
-$result .= $para->add_next('...', 1);
-$result .= $para->add_text("c");
-$result .= $para->end();
+$result .= add_text($para, "a ");
+$result .= add_next($para, '...', 1);
+$result .= add_text($para, "c");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "a ...c\n", 'add end sentence and text');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->end_line();
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= end_line($para);
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "\nafter\n", 'space after end_line');
#print STDERR "$result";
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$result .= $para->add_pending_word();
+$result .= add_text($para, 'aa.)');
+$result .= add_pending_word($para);
is ($result, 'aa.)', 'call add_pending_word');
-$result = $para->end_line();
+$result = end_line($para);
is ($result, "\n", 'call end_line after add_pending_word');
-$result = $para->end();
+$result = Texinfo::Convert::Paragraph::end($para);
is ($result, '', 'call end after end_line');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$result .= $para->add_pending_word();
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+$result .= add_pending_word($para);
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.) after\n", 'space after sentence and add_pending_word');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aA');
-$result .= $para->add_next('.');
-$para->add_end_sentence(1);
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aA');
+$result .= add_next($para, '.');
+add_end_sentence($para, 1);
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aA. after\n", 'force end sentence after upper case');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa');
-$result .= $para->add_next('.');
-$para->add_end_sentence(1);
-$result .= $para->add_text('b c');
-$result .= $para->end();
+$result .= add_text($para, 'aa');
+$result .= add_next($para, '.');
+add_end_sentence($para, 1);
+$result .= add_text($para, 'b c');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.b c\n", 'force end sentence followed by text');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aA');
-$result .= $para->add_text('.');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aA');
+$result .= add_text($para, '.');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aA. after\n", 'end sentence after upper case');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$result .= $para->add_text('))');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+$result .= add_text($para, '))');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.))) after\n", 'continue with after_punctuation_characters');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$para->remove_end_sentence();
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+remove_end_sentence($para, );
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.) after\n", 'inhibit end sentence');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$para->remove_end_sentence();
-$result .= $para->add_next('_');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+remove_end_sentence($para, );
+$result .= add_next($para, '_');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.)_ after\n", 'inhibit end sentence then add next');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$para->remove_end_sentence();
-$result .= $para->add_text('aa.)');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+remove_end_sentence($para, );
+$result .= add_text($para, 'aa.)');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.)aa.) after\n", 'cancel inhibit end sentence');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa.)');
-$para->remove_end_sentence();
-$result .= $para->add_text('))');
-$result .= $para->add_text(' after');
-$result .= $para->end();
+$result .= add_text($para, 'aa.)');
+remove_end_sentence($para, );
+$result .= add_text($para, '))');
+$result .= add_text($para, ' after');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aa.))) after\n", 'inhibit end sentence and ))');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$para->set_space_protection(undef,1,1);
-$result .= $para->add_text(' aa.) bb.');
-$result .= $para->end();
+set_space_protection($para, undef,1,1);
+$result .= add_text($para, ' aa.) bb.');
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result,"aa.) bb.\n", 'leading spaces ignore columns and keep spaces');
-$para = $paragraph_module->new({'max' => 2});
+$para = Texinfo::Convert::Paragraph->new({'max' => 2});
$result = '';
-$para->set_space_protection(1,1);
-$result .= $para->add_text('aa.) bb ');
-$result = $para->add_text(' eee ');
-$result .= $para->add_text(' .)');
-$result .= $para->add_next('_');
-$result .= $para->add_text("\n");
-$result .= $para->add_text("aa\n");
-$result .= $para->add_text(' . gg');
-$result .= $para->add_text(". \n");
-$result .= $para->add_text("a");
-$result .= $para->add_text(' ');
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text("c ");
+set_space_protection($para, 1,1);
+$result .= add_text($para, 'aa.) bb ');
+$result = add_text($para, ' eee ');
+$result .= add_text($para, ' .)');
+$result .= add_next($para, '_');
+$result .= add_text($para, "\n");
+$result .= add_text($para, "aa\n");
+$result .= add_text($para, ' . gg');
+$result .= add_text($para, ". \n");
+$result .= add_text($para, "a");
+$result .= add_text($para, ' ');
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, "c ");
is ($result, "aa.) bb eee .)_ aa . gg. a c\n", "protected spaces
many inputs");
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new({'max' => 10});
+$para = Texinfo::Convert::Paragraph->new({'max' => 10});
$result = '';
-$result .= $para->add_next("AAAAAAA");
-$result .= $para->add_text("GGG GGG");
-$result .= $para->end();
+$result .= add_next($para, "AAAAAAA");
+$result .= add_text($para, "GGG GGG");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "AAAAAAAGGG\nGGG\n", 'line split check');
-$para = $paragraph_module->new({'max' => 10});
+$para = Texinfo::Convert::Paragraph->new({'max' => 10});
$result = '';
-$result .= $para->add_next("AAAAAAA\n");
-$result .= $para->add_text("GGG GGG");
-$result .= $para->end();
+$result .= add_next($para, "AAAAAAA\n");
+$result .= add_text($para, "GGG GGG");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "AAAAAAA\nGGG GGG\n", 'end line reset counter');
-$para = $paragraph_module->new({'indent_length' => 3});
+$para = Texinfo::Convert::Paragraph->new({'indent_length' => 3});
$result = '';
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text(" a\n");
-$result .= $para->set_space_protection(0,0);
-$result .= $para->end();
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, " a\n");
+$result .= set_space_protection($para, 0,0);
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, " a \n", 'end space protection by end line');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbb bbbbb bbb b b b b b b b b b bb .\n");
-$result .= $para->add_text ("ccc dddd");
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text ("gg.\n");
-$result .= $para->end();
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbb bbbbb bbb b b b b b b b b b bb .\n");
+$result .= add_text($para, "ccc dddd");
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, "gg.\n");
+$result .= Texinfo::Convert::Paragraph::end($para);
is ($result, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbb
bbbbb bbb b b b b b b b b b bb . ccc ddddgg.\n", 'long text followed by text
protected');
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result .= $para->add_text('aa');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text(' f f');
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text("ggg\n");
+$result .= add_text($para, 'aa');
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, ' f f');
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, "ggg\n");
is ($result, 'aa f fggg', 'protected space within words');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text(' f f ');
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text("ggg\n");
+$result = add_text($para, 'aa');
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, ' f f ');
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, "ggg\n");
is ($result, 'aa f f ggg', 'protected space and space within words');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa ');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text(' f f ');
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text("ggg\n");
+$result = add_text($para, 'aa ');
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, ' f f ');
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, "ggg\n");
is ($result, 'aa f f ggg', 'text space protected space and space within
words');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa ');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text(' f f ');
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text(" ggg\n");
+$result = add_text($para, 'aa ');
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, ' f f ');
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, " ggg\n");
is ($result, 'aa f f ggg', 'text space protected space and space after');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa ');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text(" ggg\n");
+$result = add_text($para, 'aa ');
+$result .= set_space_protection($para, 1,1);
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, " ggg\n");
is ($result, 'aa ggg', 'empty protected 2 space');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa ');
-$result .= $para->set_space_protection(1,1);
-$para->set_space_protection(0,0);
-$result .= $para->add_text("ggg\n");
+$result = add_text($para, 'aa ');
+$result .= set_space_protection($para, 1,1);
+set_space_protection($para, 0,0);
+$result .= add_text($para, "ggg\n");
is ($result, 'aa ggg', 'empty protected 1 before space');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text(" ggg\n");
+$result = add_text($para, 'aa');
+$result .= set_space_protection($para, 1,1);
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, " ggg\n");
is ($result, 'aa ggg', 'empty protected 1 after space');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-$para = $paragraph_module->new();
+$para = Texinfo::Convert::Paragraph->new();
$result = '';
-$result = $para->add_text('aa ');
-$result .= $para->set_space_protection(1,1);
-$result .= $para->add_text(' ');
-$result .= $para->set_space_protection(0,0);
-$result .= $para->add_text(" ggg\n");
+$result = add_text($para, 'aa ');
+$result .= set_space_protection($para, 1,1);
+$result .= add_text($para, ' ');
+$result .= set_space_protection($para, 0,0);
+$result .= add_text($para, " ggg\n");
is ($result, 'aa ggg', 'space protected space');
-$para->end();
+Texinfo::Convert::Paragraph::end($para);
-if (!$testing_XSParagraph) {
-$para = $paragraph_module->new({'max' => 8});
-$result = $para->add_text('aa ');
-is ($para->{'lines_counter'}, 0, 'count lines first');
-$result .= $para->add_text('bbbbbbbbbbbbbbbbbbbb');
-is ($para->{'lines_counter'}, 1, 'count lines text pending');
-$result .= $para->end();
-is ($para->{'lines_counter'}, 2, 'count lines end paragraph');
- $paragraph_module = "Texinfo::Convert::Paragraph";
- $testing_XSParagraph = 1;
- goto DOITAGAIN;
-}
-
sub test_line($$$;$)
{
my $args = shift;
@@ -533,9 +520,9 @@
$conf = {} if (!defined($conf));
my $line = Texinfo::Convert::Line->new($conf);
foreach my $arg (@$args) {
- $result .= $line->add_text($arg);
+ $result .= add_text($line, $arg);
}
- $result .= $line->end();
+ $result .= Texinfo::Convert::Paragraph::end($line);
is ($result, $reference, "line $name");
#print STDERR "$result\n";
}
@@ -558,154 +545,154 @@
my $line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$result .= $line->add_next('_');
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+$result .= add_next($line, '_');
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.)_ after", 'line add char after end sentence');
$para = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->end_line();
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= end_line($line);
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "\nafter", 'line space after end_line');
#print STDERR "$result";
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text("A");
-$result .= $line->add_next('_', 1);
-$result .= $line->add_text(".)");
-$result .= $line->add_text(" Next");
-$result .= $line->end();
+$result .= add_text($line, "A");
+$result .= add_next($line, '_', 1);
+$result .= add_text($line, ".)");
+$result .= add_text($line, " Next");
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "A_.) Next", 'line add_next: period after next, transparent');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$result .= $line->add_pending_word();
+$result .= add_text($line, 'aa.)');
+$result .= add_pending_word($line);
is ($result, 'aa.)', 'line call add_pending_word');
-$result = $line->end_line();
+$result = end_line($line);
is ($result, "\n", 'line call end_line after add_pending_word');
-$result = $line->end();
+$result = Texinfo::Convert::Paragraph::end($line);
is ($result, "", 'line call end after end_line');
$para = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$result .= $line->add_pending_word();
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+$result .= add_pending_word($line);
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.) after", 'line space after sentence and add_pending_word');
$para = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aA');
-$result .= $line->add_next('.');
-$line->add_end_sentence(1);
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aA');
+$result .= add_next($line, '.');
+add_end_sentence($line, 1);
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aA. after", 'line force end sentence after upper case');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aA');
-$result .= $line->add_text('.');
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aA');
+$result .= add_text($line, '.');
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aA. after", 'line end sentence after upper case');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$result .= $line->add_text('))');
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+$result .= add_text($line, '))');
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.))) after", 'line continue with
after_punctuation_characters');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$line->remove_end_sentence();
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+remove_end_sentence($line, );
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.) after", 'line inhibit end sentence');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$line->remove_end_sentence();
-$result .= $line->add_next('_');
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+remove_end_sentence($line, );
+$result .= add_next($line, '_');
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.)_ after", 'line inhibit end sentence then add next');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$line->remove_end_sentence();
-$result .= $line->add_text('aa.)');
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+remove_end_sentence($line, );
+$result .= add_text($line, 'aa.)');
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.)aa.) after", 'line cancel inhibit end sentence');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text('aa.)');
-$line->remove_end_sentence();
-$result .= $line->add_text('))');
-$result .= $line->add_text(' after');
-$result .= $line->end();
+$result .= add_text($line, 'aa.)');
+remove_end_sentence($line, );
+$result .= add_text($line, '))');
+$result .= add_text($line, ' after');
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa.))) after", 'line inhibit end sentence and ))');
$line = Texinfo::Convert::Line->new();
$result = '';
-$line->set_space_protection(1,1);
-$result .= $line->add_text(' aa.)');
-$result .= $line->add_text(' ');
-$result .= $line->add_text('then');
-$result .= $line->add_text('fff g');
-$line->set_space_protection(0,0);
-$result .= $line->end();
+set_space_protection($line, 1,1);
+$result .= add_text($line, ' aa.)');
+$result .= add_text($line, ' ');
+$result .= add_text($line, 'then');
+$result .= add_text($line, 'fff g');
+set_space_protection($line, 0,0);
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, " aa.) thenfff g", 'line space_protection and spaces');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->add_text("aa. ");
-$result .= $line->set_space_protection(undef,undef,undef,1);
-$result .= $line->add_next('_');
-$result .= $line->add_text("b");
-$result .= $line->set_space_protection(undef,undef,undef,0);
-$result .= $line->add_text(". after");
-$result .= $line->end();
+$result .= add_text($line, "aa. ");
+$result .= set_space_protection($line, undef,undef,undef,1);
+$result .= add_next($line, '_');
+$result .= add_text($line, "b");
+$result .= set_space_protection($line, undef,undef,undef,0);
+$result .= add_text($line, ". after");
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "aa. _b. after", 'line add char after space protection end
sentence space');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->set_space_protection(undef,undef,undef,1);
-$result .= $line->add_text("b.");
-$result .= $line->set_space_protection(undef,undef,undef,0);
-$result .= $line->add_text(" follow");
-$result .= $line->end();
+$result .= set_space_protection($line, undef,undef,undef,1);
+$result .= add_text($line, "b.");
+$result .= set_space_protection($line, undef,undef,undef,0);
+$result .= add_text($line, " follow");
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "b. follow", 'line punctuation before end space protection 2
space');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->set_space_protection(1,1);
-$result .= $line->add_text("protected. B");
-$result .= $line->set_space_protection(0,0);
-$result .= $line->add_text(" after");
-$result .= $line->end();
+$result .= set_space_protection($line, 1,1);
+$result .= add_text($line, "protected. B");
+$result .= set_space_protection($line, 0,0);
+$result .= add_text($line, " after");
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "protected. B after", 'line 2 spaces after end space protection');
$line = Texinfo::Convert::Line->new();
$result = '';
-$result .= $line->set_space_protection(1,1);
-$result .= $line->add_text("protected");
-$result .= $line->set_space_protection(0,0);
-$result .= $line->add_text(" after");
-$result .= $line->end();
+$result .= set_space_protection($line, 1,1);
+$result .= add_text($line, "protected");
+$result .= set_space_protection($line, 0,0);
+$result .= add_text($line, " after");
+$result .= Texinfo::Convert::Paragraph::end($line);
is ($result, "protected after", 'line 2 spaces after end space protection with
dot');
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7624] paragraph.t no method call syntax,
gavinsmith0123 <=