[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Common.pm t/test_protect_has...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Common.pm t/test_protect_has... |
Date: |
Sat, 02 Feb 2013 15:41:12 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 13/02/02 15:41:12
Modified files:
tp/Texinfo : Common.pm
tp/t : test_protect_hashchar_at_line_beginning.t
tp/tests/sectioning/res_parser/equivalent_nodes:
equivalent_nodes.2
tp/tests/sectioning/res_parser/equivalent_nodes_no_node:
equivalent_nodes.2
tp/tests/sectioning/res_parser/equivalent_nodes_test_renamed_nodes:
equivalent_nodes.2
tp/tests/sectioning/res_parser_html/equivalent_nodes:
equivalent_nodes.2
tp/tests/sectioning/res_parser_html/equivalent_nodes_no_node:
equivalent_nodes.2
tp/tests/sectioning/res_parser_html/equivalent_nodes_test_renamed_nodes:
equivalent_nodes.2
Log message:
Improve warnings.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.178&r2=1.179
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_protect_hashchar_at_line_beginning.t?cvsroot=texinfo&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/sectioning/res_parser/equivalent_nodes/equivalent_nodes.2?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/sectioning/res_parser/equivalent_nodes_no_node/equivalent_nodes.2?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/sectioning/res_parser/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2?cvsroot=texinfo&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/sectioning/res_parser_html/equivalent_nodes/equivalent_nodes.2?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/sectioning/res_parser_html/equivalent_nodes_no_node/equivalent_nodes.2?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/sectioning/res_parser_html/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2?cvsroot=texinfo&r1=1.6&r2=1.7
Patches:
Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -b -r1.178 -r1.179
--- Texinfo/Common.pm 30 Jan 2013 00:54:31 -0000 1.178
+++ Texinfo/Common.pm 2 Feb 2013 15:41:10 -0000 1.179
@@ -1093,7 +1093,7 @@
if (defined($file)) {
if (!open(VERBINCLUDE, $file)) {
if ($self) {
- $self->line_error (sprintf($self->__("Cannot read %s: %s"), $file,
$!),
+ $self->line_error(sprintf($self->__("could not read %s: %s"), $file,
$!),
$current->{'line_nr'});
}
} else {
@@ -1497,8 +1497,8 @@
$renamed_nodes_lines->{$_} = $renamed_nodes_line_nr;
@old_names = ();
} else {
- warn (sprintf($self->__("%s:%d: no node to be renamed\n"),
- $renamed_nodes_file, $renamed_nodes_line_nr));
+ $self->file_line_warn($self->__("no node to be renamed"),
+ $renamed_nodes_file, $renamed_nodes_line_nr);
}
} else {
chomp;
@@ -1508,8 +1508,8 @@
}
}
if (scalar(@old_names)) {
- warn (sprintf($self->__("%s:%d: nodes without a new name at the end of
file\n"),
- $renamed_nodes_file, $renamed_nodes_line_nr));
+ $self->file_line_warn($self->__("nodes without a new name at the end of
file"),
+ $renamed_nodes_file, $renamed_nodes_line_nr);
}
if (!close(RENAMEDFILE)) {
$self->document_warn(sprintf($self->__p(
@@ -1999,7 +1999,7 @@
while ($parent) {
if ($parent->{'cmdname'} and $parent->{'line_nr'}) {
$self->line_warn(sprintf($self->__(
- "protect_hashchar_at_line_beginning cannot protect in
address@hidden"),
+ "could not protect hash character in address@hidden"),
$parent->{'cmdname'}),
$parent->{'line_nr'});
last;
}
Index: t/test_protect_hashchar_at_line_beginning.t
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/test_protect_hashchar_at_line_beginning.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- t/test_protect_hashchar_at_line_beginning.t 22 Feb 2012 00:03:45 -0000
1.4
+++ t/test_protect_hashchar_at_line_beginning.t 2 Feb 2013 15:41:11 -0000
1.5
@@ -1,7 +1,7 @@
use strict;
use Test::More;
-BEGIN { plan tests => 4 };
+BEGIN { plan tests => 6 };
use lib 'maintain/lib/Unicode-EastAsianWidth/lib/';
use lib 'maintain/lib/libintl-perl/lib/';
@@ -14,15 +14,36 @@
ok(1);
-sub run_test($$$)
+sub run_test($$$;$)
{
my $in = shift;
my $out = shift;
my $name = shift;
+ my $error_message = shift;
- my $tree = parse_texi_text(undef, $in);
+ my $parser = Texinfo::Parser::parser();
+ my $tree = $parser->parse_texi_text($in, 1);
+
+ my $corrected_tree =
+ $parser->Texinfo::Common::protect_hashchar_at_line_beginning($tree);
+
+ if (defined($error_message)) {
+ my ($errors, $errors_count) = $parser->errors();
+ if (!$error_message) {
+ if ($errors and scalar(@$errors)) {
+ print STDERR " --error-> $errors->[0]->{'error_line'}";
+ } else {
+ print STDERR "No message\n";
+ }
+ } else {
+ if ($errors and scalar(@$errors)) {
+ is($error_message, $errors->[0]->{'error_line'}, "error message:
$name");
+ } else {
+ ok(0, "error message: $name");
+ }
+ }
+ }
- my $corrected_tree = protect_hashchar_at_line_beginning(undef, $tree);
my $texi_result = Texinfo::Convert::Texinfo::convert($corrected_tree);
if (!defined($out)) {
@@ -98,6 +119,17 @@
@end itemize
', 'in block commands');
+run_test('
address@hidden mymacro {}
+# line 20 "ff"
address@hidden macro
+', '
address@hidden mymacro {}
+# line 20 "ff"
address@hidden macro
+', 'in raw command', ':2: warning: could not protect hash character in @macro
+');
+
#{
# local $Data::Dumper::Purity = 1;
Index: tests/sectioning/res_parser/equivalent_nodes/equivalent_nodes.2
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/tests/sectioning/res_parser/equivalent_nodes/equivalent_nodes.2,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- tests/sectioning/res_parser/equivalent_nodes/equivalent_nodes.2 30 Jan
2013 00:54:43 -0000 1.5
+++ tests/sectioning/res_parser/equivalent_nodes/equivalent_nodes.2 2 Feb
2013 15:41:11 -0000 1.6
@@ -4,6 +4,6 @@
equivalent_nodes.texi:12: warning: Menu entry node name address@hidden'
different from node name `node'
equivalent_nodes.texi:5: warning: unreferenced node `before top'
equivalent_nodes.texi:5: warning: Next pointer address@hidden' (for node
`before top') different from node name `node'
-equivalent_nodes-noderename.cnf:8: no node to be renamed
-equivalent_nodes-noderename.cnf:10: nodes without a new name at the end of file
+equivalent_nodes-noderename.cnf:8: warning: no node to be renamed
+equivalent_nodes-noderename.cnf:10: warning: nodes without a new name at the
end of file
equivalent_nodes.texi: warning: must specify a title with a title command or
@top
Index: tests/sectioning/res_parser/equivalent_nodes_no_node/equivalent_nodes.2
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/tests/sectioning/res_parser/equivalent_nodes_no_node/equivalent_nodes.2,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- tests/sectioning/res_parser/equivalent_nodes_no_node/equivalent_nodes.2
30 Jan 2013 00:54:43 -0000 1.5
+++ tests/sectioning/res_parser/equivalent_nodes_no_node/equivalent_nodes.2
2 Feb 2013 15:41:11 -0000 1.6
@@ -4,6 +4,6 @@
equivalent_nodes.texi:12: warning: Menu entry node name address@hidden'
different from node name `node'
equivalent_nodes.texi:5: warning: unreferenced node `before top'
equivalent_nodes.texi:5: warning: Next pointer address@hidden' (for node
`before top') different from node name `node'
-equivalent_nodes-noderename.cnf:8: no node to be renamed
-equivalent_nodes-noderename.cnf:10: nodes without a new name at the end of file
+equivalent_nodes-noderename.cnf:8: warning: no node to be renamed
+equivalent_nodes-noderename.cnf:10: warning: nodes without a new name at the
end of file
equivalent_nodes.texi: warning: must specify a title with a title command or
@top
Index:
tests/sectioning/res_parser/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/tests/sectioning/res_parser/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
---
tests/sectioning/res_parser/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2
30 Jan 2013 00:54:43 -0000 1.6
+++
tests/sectioning/res_parser/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2
2 Feb 2013 15:41:11 -0000 1.7
@@ -4,8 +4,8 @@
equivalent_nodes.texi:12: warning: Menu entry node name address@hidden'
different from node name `node'
equivalent_nodes.texi:5: warning: unreferenced node `before top'
equivalent_nodes.texi:5: warning: Next pointer address@hidden' (for node
`before top') different from node name `node'
-equivalent_nodes-noderename.cnf:8: no node to be renamed
-equivalent_nodes-noderename.cnf:10: nodes without a new name at the end of file
+equivalent_nodes-noderename.cnf:8: warning: no node to be renamed
+equivalent_nodes-noderename.cnf:10: warning: nodes without a new name at the
end of file
equivalent_nodes.texi: warning: must specify a title with a title command or
@top
equivalent_nodes-noderename.cnf: old name for `ToP' is a node of the document
equivalent_nodes-noderename.cnf: old name for `Top' is a node of the document
Index: tests/sectioning/res_parser_html/equivalent_nodes/equivalent_nodes.2
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/tests/sectioning/res_parser_html/equivalent_nodes/equivalent_nodes.2,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- tests/sectioning/res_parser_html/equivalent_nodes/equivalent_nodes.2
30 Jan 2013 00:54:45 -0000 1.5
+++ tests/sectioning/res_parser_html/equivalent_nodes/equivalent_nodes.2
2 Feb 2013 15:41:12 -0000 1.6
@@ -4,6 +4,6 @@
equivalent_nodes.texi:12: warning: Menu entry node name address@hidden'
different from node name `node'
equivalent_nodes.texi:5: warning: unreferenced node `before top'
equivalent_nodes.texi:5: warning: Next pointer address@hidden' (for node
`before top') different from node name `node'
-equivalent_nodes-noderename.cnf:8: no node to be renamed
-equivalent_nodes-noderename.cnf:10: nodes without a new name at the end of file
+equivalent_nodes-noderename.cnf:8: warning: no node to be renamed
+equivalent_nodes-noderename.cnf:10: warning: nodes without a new name at the
end of file
equivalent_nodes.texi: warning: must specify a title with a title command or
@top
Index:
tests/sectioning/res_parser_html/equivalent_nodes_no_node/equivalent_nodes.2
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/tests/sectioning/res_parser_html/equivalent_nodes_no_node/equivalent_nodes.2,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
---
tests/sectioning/res_parser_html/equivalent_nodes_no_node/equivalent_nodes.2
30 Jan 2013 00:54:45 -0000 1.5
+++
tests/sectioning/res_parser_html/equivalent_nodes_no_node/equivalent_nodes.2
2 Feb 2013 15:41:12 -0000 1.6
@@ -4,6 +4,6 @@
equivalent_nodes.texi:12: warning: Menu entry node name address@hidden'
different from node name `node'
equivalent_nodes.texi:5: warning: unreferenced node `before top'
equivalent_nodes.texi:5: warning: Next pointer address@hidden' (for node
`before top') different from node name `node'
-equivalent_nodes-noderename.cnf:8: no node to be renamed
-equivalent_nodes-noderename.cnf:10: nodes without a new name at the end of file
+equivalent_nodes-noderename.cnf:8: warning: no node to be renamed
+equivalent_nodes-noderename.cnf:10: warning: nodes without a new name at the
end of file
equivalent_nodes.texi: warning: must specify a title with a title command or
@top
Index:
tests/sectioning/res_parser_html/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/tests/sectioning/res_parser_html/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
---
tests/sectioning/res_parser_html/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2
30 Jan 2013 00:54:45 -0000 1.6
+++
tests/sectioning/res_parser_html/equivalent_nodes_test_renamed_nodes/equivalent_nodes.2
2 Feb 2013 15:41:12 -0000 1.7
@@ -4,8 +4,8 @@
equivalent_nodes.texi:12: warning: Menu entry node name address@hidden'
different from node name `node'
equivalent_nodes.texi:5: warning: unreferenced node `before top'
equivalent_nodes.texi:5: warning: Next pointer address@hidden' (for node
`before top') different from node name `node'
-equivalent_nodes-noderename.cnf:8: no node to be renamed
-equivalent_nodes-noderename.cnf:10: nodes without a new name at the end of file
+equivalent_nodes-noderename.cnf:8: warning: no node to be renamed
+equivalent_nodes-noderename.cnf:10: warning: nodes without a new name at the
end of file
equivalent_nodes.texi: warning: must specify a title with a title command or
@top
equivalent_nodes-noderename.cnf: old name for `ToP' is a node of the document
equivalent_nodes-noderename.cnf: old name for `Top' is a node of the document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp Texinfo/Common.pm t/test_protect_has...,
Patrice Dumas <=