texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6764] paragraph.t module switching


From: Gavin D. Smith
Subject: [6764] paragraph.t module switching
Date: Sat, 07 Nov 2015 21:31:17 +0000

Revision: 6764
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6764
Author:   gavin
Date:     2015-11-07 21:31:16 +0000 (Sat, 07 Nov 2015)
Log Message:
-----------
paragraph.t module switching

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/t/paragraph.t

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-11-07 18:07:55 UTC (rev 6763)
+++ trunk/ChangeLog     2015-11-07 21:31:16 UTC (rev 6764)
@@ -1,5 +1,12 @@
 2015-11-07  Gavin Smith  <address@hidden>
 
+       * tp/t/paragraph.t: Access paragraph formatting modules via a 
+       string with the name of the module in it.  Aliasing a module's 
+       namespace to switch between modules doesn't seem to work 
+       reliably.
+
+2015-11-07  Gavin Smith  <address@hidden>
+
        * tp/Texinfo/Convert/XSParagraph/TestXS.pm: Always print 
        debugging output, and remove fallback code copied from 
        XSParagraph.pm.

Modified: trunk/tp/t/paragraph.t
===================================================================
--- trunk/tp/t/paragraph.t      2015-11-07 18:07:55 UTC (rev 6763)
+++ trunk/tp/t/paragraph.t      2015-11-07 21:31:16 UTC (rev 6764)
@@ -22,14 +22,15 @@
 }; # end BEGIN
 
 use Texinfo::Convert::ParagraphNonXS;
+use Texinfo::Convert::Paragraph;
 use Texinfo::Convert::Line;
 use Texinfo::Convert::UnFilled;
 
-# We do the test for Texinfo::Convert::Paragraph tests twice, once with 
-# Texinfo::Convert::Paragraph, once with XSParagraph.  A few them are only 
done 
-# once, though.
-local *xsmodule = *Texinfo::Convert::Paragraph::;
-*Texinfo::Convert::Paragraph:: = *Texinfo::Convert::ParagraphNonXS::;
+# 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.
@@ -44,7 +45,7 @@
   my $result = '';
   #$conf = {'DEBUG' => 1} if (!defined($conf));
   $conf = {} if (!defined($conf));
-  my $para = Texinfo::Convert::Paragraph->new($conf);
+  my $para = $paragraph_module->new($conf);
   foreach my $arg (@$args) {
     $result .= $para->add_text($arg);
   }
@@ -147,7 +148,7 @@
   "counter_and_line", {'counter' => 60});
 
 
-my $para = Texinfo::Convert::Paragraph->new();
+my $para = $paragraph_module->new();
 my $result = '';
 $result .= $para->add_text('aa.)');
 $result .= $para->add_next('_');
@@ -155,7 +156,7 @@
 $result .= $para->end();
 is ($result, "aa.)_  after\n", 'add char after end sentence parentheses');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('b ');
 $result .= $para->add_next('_');
@@ -165,7 +166,7 @@
 $result .= $para->end();
 is ($result, "b _._  after\n", 'add char after end sentence');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_next('a');
 $result .= $para->add_next("\n");
@@ -173,14 +174,14 @@
 $result .= $para->end();
 is ($result, "a\n_\n", 'add_next: add char after separate end line');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_next("a\n");
 $result .= $para->add_next('_');
 $result .= $para->end();
 is ($result, "a\n_\n", 'add_next: add char after end line');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text("A");
 $result .= $para->add_next('_');
@@ -189,7 +190,7 @@
 $result .= $para->end();
 is ($result, "A_.)  Next\n", 'add_next: period after next, not transparent');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text("A");
 $result .= $para->add_next('_', 1);
@@ -198,7 +199,7 @@
 $result .= $para->end();
 is ($result, "A_.) Next\n", 'add_next: period after next, transparent');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text("aa.\n");
 $result .= $para->set_space_protection(undef,undef,undef,1);
@@ -207,7 +208,7 @@
 $result .= $para->end();
 is ($result, "aa.  _b\n", 'add char after space protection end sentence 
space');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->set_space_protection(undef,undef,undef,1);
 $result .= $para->add_text("b");
@@ -216,7 +217,7 @@
 $result .= $para->end();
 is ($result, "b.  after\n", 'punctuation after end space protection');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->set_space_protection(undef,undef,undef,1);
 $result .= $para->add_text("b.");
@@ -225,7 +226,7 @@
 $result .= $para->end();
 is ($result, "b. follow\n", 'punctuation before end space protection');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->set_space_protection(undef,undef,undef,1);
 $result .= $para->add_text("b.");
@@ -234,7 +235,7 @@
 $result .= $para->end();
 is ($result, "b. follow\n", 'punctuation before end space protection 2 space');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->set_space_protection(undef,undef,undef,1);
 $result .= $para->add_text("b. ");
@@ -244,7 +245,7 @@
 is ($result, "b. follow\n", 'punctuation space before end space protection');
 
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text("In w:\n");
 $result .= $para->set_space_protection(1,1);
@@ -252,7 +253,7 @@
 $result .= $para->end();
 is ($result, "In w: Out of code -- out-of-code.   
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\n", 'space 
protection after end sentence');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text("In w:\n");
 $result .= $para->set_space_protection(1,1);
@@ -262,7 +263,7 @@
 $result .= $para->end();
 is ($result, "In w: Out of code -- out-of-code.in code\n", 'set frenchspacing 
after space protection');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text("a ");
 $result .= $para->add_next('...', 1);
@@ -270,7 +271,7 @@
 $result .= $para->end();
 is ($result, "a ...c\n", 'add end sentence and text');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->end_line();
 $result .= $para->add_text(' after');
@@ -278,7 +279,7 @@
 is ($result, "\nafter\n", 'space after end_line');
 #print STDERR "$result";
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $result .= $para->add_pending_word();
@@ -288,7 +289,7 @@
 $result = $para->end();
 is ($result, '', 'call end after end_line');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $result .= $para->add_pending_word();
@@ -296,7 +297,7 @@
 $result .= $para->end();
 is ($result, "aa.)  after\n", 'space after sentence and add_pending_word');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aA');
 $result .= $para->add_next('.');
@@ -305,7 +306,7 @@
 $result .= $para->end();
 is ($result, "aA.  after\n", 'force end sentence after upper case');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa');
 $result .= $para->add_next('.');
@@ -314,7 +315,7 @@
 $result .= $para->end();
 is ($result, "aa.b c\n", 'force end sentence followed by text');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aA');
 $result .= $para->add_text('.');
@@ -322,7 +323,7 @@
 $result .= $para->end();
 is ($result, "aA. after\n", 'end sentence after upper case');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $result .= $para->add_text('))');
@@ -330,7 +331,7 @@
 $result .= $para->end();
 is ($result, "aa.)))  after\n", 'continue with after_punctuation_characters');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $para->remove_end_sentence();
@@ -338,7 +339,7 @@
 $result .= $para->end();
 is ($result, "aa.) after\n", 'inhibit end sentence');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $para->remove_end_sentence();
@@ -347,7 +348,7 @@
 $result .= $para->end();
 is ($result, "aa.)_ after\n", 'inhibit end sentence then add next');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $para->remove_end_sentence();
@@ -356,7 +357,7 @@
 $result .= $para->end();
 is ($result, "aa.)aa.)  after\n", 'cancel inhibit end sentence');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa.)');
 $para->remove_end_sentence();
@@ -365,7 +366,7 @@
 $result .= $para->end();
 is ($result, "aa.))) after\n", 'inhibit end sentence and ))');
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $para->set_space_protection(undef,1,1);
 $result .= $para->add_text('  aa.) bb.');
@@ -374,7 +375,7 @@
 
 
 
-$para = Texinfo::Convert::Paragraph->new({'max' => 2});
+$para = $paragraph_module->new({'max' => 2});
 $result = '';
 $para->set_space_protection(1,1);
 $result .= $para->add_text('aa.)    bb ');
@@ -392,21 +393,21 @@
 is ($result, "aa.)    bb  eee    .)_ aa  . gg.  a  c\n", "protected spaces 
many inputs");
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new({'max' => 10});
+$para = $paragraph_module->new({'max' => 10});
 $result = '';
 $result .= $para->add_next("AAAAAAA");
 $result .= $para->add_text("GGG GGG");
 $result .= $para->end();
 is ($result, "AAAAAAAGGG\nGGG\n", 'line split check');
 
-$para = Texinfo::Convert::Paragraph->new({'max' => 10});
+$para = $paragraph_module->new({'max' => 10});
 $result = '';
 $result .= $para->add_next("AAAAAAA\n");
 $result .= $para->add_text("GGG GGG");
 $result .= $para->end();
 is ($result, "AAAAAAA\nGGG GGG\n", 'end line reset counter');
 
-$para = Texinfo::Convert::Paragraph->new({'indent_length' => 3});
+$para = $paragraph_module->new({'indent_length' => 3});
 $result = '';
 $result .= $para->set_space_protection(1,1);
 $result .= $para->add_text(" a\n");
@@ -414,7 +415,7 @@
 $result .= $para->end();
 is ($result, "    a \n", 'end space protection by end line'); 
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->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");
@@ -424,7 +425,7 @@
 $result .= $para->end();
 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 = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result .= $para->add_text('aa');
 $result .= $para->set_space_protection(1,1);
@@ -434,7 +435,7 @@
 is ($result, 'aa  f  fggg', 'protected space within words');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa');
 $result .= $para->set_space_protection(1,1);
@@ -444,7 +445,7 @@
 is ($result, 'aa  f  f ggg', 'protected space and space within words');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa ');
 $result .= $para->set_space_protection(1,1);
@@ -454,7 +455,7 @@
 is ($result, 'aa   f  f ggg', 'text space protected space and space within 
words');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa ');
 $result .= $para->set_space_protection(1,1);
@@ -464,7 +465,7 @@
 is ($result, 'aa   f  f  ggg', 'text space protected space and space after');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa ');
 $result .= $para->set_space_protection(1,1);
@@ -473,7 +474,7 @@
 is ($result, 'aa  ggg', 'empty protected 2 space');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa ');
 $result .= $para->set_space_protection(1,1);
@@ -482,7 +483,7 @@
 is ($result, 'aa ggg', 'empty protected 1 before space');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa');
 $result .= $para->set_space_protection(1,1);
@@ -491,7 +492,7 @@
 is ($result, 'aa ggg', 'empty protected 1 after space');
 $para->end();
 
-$para = Texinfo::Convert::Paragraph->new();
+$para = $paragraph_module->new();
 $result = '';
 $result = $para->add_text('aa ');
 $result .= $para->set_space_protection(1,1);
@@ -502,7 +503,7 @@
 $para->end();
 
 if (!$testing_XSParagraph) {
-$para = Texinfo::Convert::Paragraph->new({'max' => 8});
+$para = $paragraph_module->new({'max' => 8});
 $result = $para->add_text('aa ');
 is ($para->{'lines_counter'}, 0, 'count lines first');
 $result .= $para->add_text('bbbbbbbbbbbbbbbbbbbb');
@@ -510,8 +511,7 @@
 $result .= $para->end();
 is ($para->{'lines_counter'}, 2, 'count lines end paragraph');
 
-  use Texinfo::Convert::Paragraph;
-  *Texinfo::Convert::Paragraph:: = *xsmodule;
+  $paragraph_module = "Texinfo::Convert::Paragraph";
   $testing_XSParagraph = 1;
   goto DOITAGAIN;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]