texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp/t test_count.t


From: Patrice Dumas
Subject: texinfo/tp/t test_count.t
Date: Sat, 22 Jan 2011 17:39:43 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/01/22 17:39:43

Modified files:
        tp/t           : test_count.t 

Log message:
        Adapt to the new counting scheme.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_count.t?cvsroot=texinfo&r1=1.2&r2=1.3

Patches:
Index: test_count.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_count.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- test_count.t        20 Jan 2011 00:38:32 -0000      1.2
+++ test_count.t        22 Jan 2011 17:39:43 -0000      1.3
@@ -28,39 +28,39 @@
   my $self = shift;
   my $root = shift;
 
+  
+  $self->{'command_type_nr'}++;
+  my $string = 
"($self->{'count_context'}->[-1]->{'bytes'},$self->{'count_context'}->[-1]->{'lines'})
 ";
+  my $command_type = '['.$self->{'command_type_nr'}.'] ';
+  $command_type .= '@'.$root->{'cmdname'} if ($root->{'cmdname'});
+  $command_type .= ":$root->{'type'}" if ($root->{'type'});
+  $command_type .= ":text" if (defined($root->{'text'}));
+  $string .= $command_type."\n";
+  push @{$self->{'debug_count_strings'}}, $string;
+  
   my $text =
     Texinfo::Convert::Plaintext::_convert($self, $root);
-  my $string = '';
-  $string .= '@'.$root->{'cmdname'} if ($root->{'cmdname'});
-  $string .= ":$root->{'type'}" if ($root->{'type'});
-  $string .= ":text" if (defined($root->{'text'}));
-  #if ($counts) {
-  #  if (defined($counts->{'bytes'})) {
-  #    $string .= ", b $counts->{'bytes'}";
-  #  }
-  #  if (defined($counts->{'lines'})) {
-  #    $string .= ", l $counts->{'lines'}";
-  #  }
-  #  if ($locations) {
-  #    foreach my $location (@$locations) {
-  #      $string .= "|";
-  #      if (defined($location->{'lines'})) {
-  #        $string .= " l $location->{'lines'}";
-  #      }
-  #      if (defined($location->{'bytes'})) {
-  #        $string .= " b $location->{'bytes'}";
-  #      }
-  #    }
-  #  }
-  #}
-  #print STDERR "$string\n";
-  #return ($text, $counts, $locations);
+  my $location_string = '';
+  if ($self->{'count_context'}->[-1]->{'locations'}) {
+    foreach my $location (@{$self->{'count_context'}->[-1]->{'locations'}}) {
+      $location_string .= "  l ";
+      if (defined($location->{'lines'})) {
+        $location_string .= " l $location->{'lines'}";
+      }
+      if (defined($location->{'bytes'})) {
+        $location_string .= " b $location->{'bytes'}";
+      }
+      $location_string .= "\n";
+    }
+  }
+  push @{$self->{'debug_count_strings'}}, "locations $command_type\n" 
.$location_string
+     if ($location_string ne '');
   return $text;
 }
 
 }
 
-my @test_cases1 = (
+my @test_cases = (
 ['commands',
 '@TeX{}. Ab. @@. @
 @~e, @address@hidden
@@ -94,7 +94,7 @@
 @end flushright
 ']);
 
-my @test_cases = (
+my @test_cases3 = (
 ['multitable',
 '
 @multitable {aaa} {bb1} {ccc}
@@ -117,9 +117,11 @@
   my $tree = $parser->parse_texi_text($test_case->[1]);
   my $converter = Texinfo::DebugCount->converter({'DEBUG' => $debug, 
                                                   'parser' => $parser});
-  my ($converted_text) = $converter->_convert($tree);
-
-#  print STDERR $converted_text;
+  $converter->{'debug_count_strings'} = [];
+  $converter->{'command_type_nr'} = 0;
+  my $converted_text = $converter->_convert($tree);
+  #print STDERR @{$converter->{'debug_count_strings'}};
+  #print STDERR $converted_text;
 }
 
 1;



reply via email to

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