texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Parser.pm t/test_utils.pl


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Parser.pm t/test_utils.pl
Date: Sun, 25 Mar 2012 23:57:40 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        12/03/25 23:57:40

Modified files:
        tp             : TODO 
        tp/Texinfo     : Parser.pm 
        tp/t           : test_utils.pl 

Log message:
        t/test_utils.pl: error out when a test name is given but none is found.
        Improve texinfo file outputting.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.275&r2=1.276
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.366&r2=1.367
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.115&r2=1.116

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -b -r1.275 -r1.276
--- TODO        9 Mar 2012 00:14:11 -0000       1.275
+++ TODO        25 Mar 2012 23:57:39 -0000      1.276
@@ -15,6 +15,12 @@
 Delayed bugs
 ============
 
address@hidden in index entries are transliterated when sorting, they should
+certainly be converted to unicode instead.
+
+Sorting of index entries should be locale dependent and sort properly
+unicode sorting.
+
 Punctuation and spaces before @image do not lead to a doubling of space.
 In fact @image is completly formatted outside of usual formatting containers.
 Not sure what should be the right way?

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.366
retrieving revision 1.367
diff -u -b -r1.366 -r1.367
--- Texinfo/Parser.pm   3 Mar 2012 15:15:37 -0000       1.366
+++ Texinfo/Parser.pm   25 Mar 2012 23:57:39 -0000      1.367
@@ -453,11 +453,13 @@
 $full_line_commands{'center'} = 1;
 $full_line_commands{'exdent'} = 1;
 
+
 my @preformatted_contexts = ('preformatted', 'rawpreformatted');
 my %preformatted_contexts;
 foreach my $preformatted_context (@preformatted_contexts) {
   $preformatted_contexts{$preformatted_context} = 1;
 }
+
 # contexts on the context_stack stack where empty line don't trigger
 # paragraph
 my %no_paragraph_contexts;

Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -b -r1.115 -r1.116
--- t/test_utils.pl     23 Feb 2012 22:14:42 -0000      1.115
+++ t/test_utils.pl     25 Mar 2012 23:57:40 -0000      1.116
@@ -976,17 +976,25 @@
   my $debug = shift;
 
   my $test = new_test($name, $generate, $debug);
-  my $ran_tests = $test_cases;
+  my $ran_tests;
   if (defined($test_case_name)) {
     if ($test_case_name =~ /^\d+$/) {
       $ran_tests = [ $test_cases->[$test_case_name-1] ];
     } else {
       foreach my $test_case (@$test_cases) {
-        $ran_tests = [ $test_case ] if ($test_case->[0] eq $test_case_name);
+        if ($test_case->[0] eq $test_case_name) {
+          $ran_tests = [ $test_case ];
+          last;
       }
     }
   }
+  } else {
+    $ran_tests = $test_cases;
+  }
 
+  if (!defined($ran_tests)) {
+    die "No test\n";
+  }
   my $test_nrs = 0;
 
   foreach my $test_case (@$ran_tests) {
@@ -1009,6 +1017,7 @@
   my $test_case = shift;
   my $test_name = shift @$test_case;
   my $test_text = shift @$test_case;
+  my $test_options = shift @$test_case;
 
   my $dir = "texi/$self->{'name'}/";
   mkdir "texi/" or die 
@@ -1017,31 +1026,55 @@
      unless (-d $dir);
   my $file = "${dir}$test_name.texi";
   open (OUTFILE, ">$file") or die ("Open $file: $!\n");
+
+  my $first_line = "\\input texinfo address@hidden -*-texinfo-*-";
+  if (!defined($test_text)) {
+    my $test_file;
+    if ($test_options and $test_options->{'test_file'}) {
+      $test_file = $input_files_dir . $test_options->{'test_file'};
+      if (open (INFILE, $test_file)) {
+        my $holdTerminator = $/;
+        undef $/;
+        $test_text = <INFILE>;
+        $/ = $holdTerminator;
+      } else {
+        die "Open $test_file: $!\n";
+      }
+      if ($test_text =~ /^\\input texinfo *\@/m
+          or $test_text =~ /^\\input texinfo *$/m) {
+        $first_line = "";
+      }
+    }
+  }
   my $setfilename;
-  if ($test_text =~ /address@hidden/) {
+  if ($test_text =~ /address@hidden/m) {
     $setfilename = ''
   } else {
     $setfilename = "address@hidden $test_name.info\n";
   }
   my $node_top;
   my $top = '';
-  if ($test_text =~ /address@hidden +top *\@/i or $test_text =~ 
/address@hidden +top *$/i) {
+  if ($test_text =~ /address@hidden +top *\@/mi or $test_text =~ 
/address@hidden +top *$/mi) {
     $node_top = "address@hidden Top\n";
-    unless ($test_text =~ /address@hidden *\@/ or $test_text =~ 
/address@hidden *$/) {
+    unless ($test_text =~ /address@hidden *\@/m or $test_text =~ 
/address@hidden *$/m) {
       $node_top .= "address@hidden $test_name\n";
     }
   } else {
     $node_top = '';
   }
-  print OUTFILE "\\input texinfo address@hidden -*-texinfo-*-
+  my $bye = '';
+  if ($test_text !~ /address@hidden *$/m) {
+    $bye = '@bye';
+  }
+  print OUTFILE "$first_line
 
 $setfilename
 $node_top
 
 $test_text
 
address@hidden";
-  close (OUTFILE);
+$bye\n";
+  close (OUTFILE) or die "Close $file: $!\n";
 }
 
 1;



reply via email to

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