texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Thu, 2 May 2024 18:44:07 -0400 (EDT)

branch: master
commit aea5c1f60f3da68c4ff5fdea0c93b6e82a034142
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu May 2 23:11:21 2024 +0200

    * tp/Makefile.tres, tp/t/converters_tests.t (extension_undef): add a
    test with EXTENSION undef.
---
 ChangeLog                                          |   5 +
 tp/Makefile.tres                                   |   6 +
 tp/t/converters_tests.t                            |   8 +
 tp/t/results/converters_tests/extension_undef.pl   | 225 +++++++++++++++++++++
 .../extension_undef/res_docbook/extension_undef    |  14 ++
 .../extension_undef/res_html/chapter               |  41 ++++
 .../extension_undef/res_info/extension_undef       |  23 +++
 .../extension_undef/res_latex/extension_undef      |  50 +++++
 .../extension_undef/res_xml/extension_undef        |  12 ++
 tp/t/test_utils.pl                                 |   2 +-
 10 files changed, 385 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6664f82a53..68ed6a5554 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-05-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Makefile.tres, tp/t/converters_tests.t (extension_undef): add a
+       test with EXTENSION undef.
+
 2024-05-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (converter_initialize)
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 54703d05d0..10e218de03 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -185,6 +185,12 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/converters_tests/empty/res_xml \
   t/results/converters_tests/empty_accent.pl \
   t/results/converters_tests/enumerate_above_ten.pl \
+  t/results/converters_tests/extension_undef.pl \
+  t/results/converters_tests/extension_undef/res_docbook \
+  t/results/converters_tests/extension_undef/res_html \
+  t/results/converters_tests/extension_undef/res_info \
+  t/results/converters_tests/extension_undef/res_latex \
+  t/results/converters_tests/extension_undef/res_xml \
   t/results/converters_tests/footnote_no_number.pl \
   t/results/converters_tests/footnote_no_number_separate.pl \
   t/results/converters_tests/form_feeds.pl \
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index 4c72232a3b..02cc201e3c 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -1331,6 +1331,14 @@ undef, {'test_file' => 
'../../tests/formatting/indices_in_begin_tables_lists.tex
 @cite{c--ite in example}
 @end example
 '],
+['extension_undef',
+'node Top
+@top top
+
+@node chapter
+@chapter Chap
+', {'test_input_file_name' => 'extension_undef.texi'}, {'EXTENSION' => undef},
+],
 );
 
 my %info_tests = (
diff --git a/tp/t/results/converters_tests/extension_undef.pl 
b/tp/t/results/converters_tests/extension_undef.pl
new file mode 100644
index 0000000000..47c811fcf7
--- /dev/null
+++ b/tp/t/results/converters_tests/extension_undef.pl
@@ -0,0 +1,225 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'extension_undef'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'type' => 'preamble_before_content'
+        },
+        {
+          'contents' => [
+            {
+              'text' => 'node Top
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 2
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'chapter'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'is_target' => 1,
+        'normalized' => 'chapter'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 4
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'extra' => {
+        'section_number' => '1'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 5
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'extension_undef'} = 'node Top
+@top top
+
+@node chapter
+@chapter Chap
+';
+
+
+$result_texts{'extension_undef'} = 'node Top
+top
+***
+
+1 Chap
+******
+';
+
+$result_sectioning{'extension_undef'} = {
+  'extra' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'section_childs' => [
+            {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'associated_node' => {
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'normalized' => 'chapter'
+                  }
+                },
+                'section_directions' => {
+                  'up' => {}
+                },
+                'section_level' => 1,
+                'section_number' => '1',
+                'toplevel_directions' => {
+                  'prev' => {},
+                  'up' => {}
+                }
+              }
+            }
+          ],
+          'section_level' => 0,
+          'sectioning_root' => {},
+          'toplevel_directions' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'section_directions'}{'up'}
 = $result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'toplevel_directions'}{'prev'}
 = $result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'toplevel_directions'}{'up'}
 = $result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'extension_undef'}{'extra'}{'section_childs'}[0]{'extra'}{'sectioning_root'}
 = $result_sectioning{'extension_undef'};
+
+$result_nodes{'extension_undef'} = [
+  {
+    'cmdname' => 'node',
+    'extra' => {
+      'associated_section' => {
+        'cmdname' => 'chapter',
+        'extra' => {
+          'section_number' => '1'
+        }
+      },
+      'normalized' => 'chapter'
+    }
+  }
+];
+
+$result_menus{'extension_undef'} = [
+  {
+    'extra' => {
+      'normalized' => 'chapter'
+    }
+  }
+];
+
+$result_errors{'extension_undef'} = [];
+
+
+$result_floats{'extension_undef'} = {};
+
+
+$result_converted_errors{'file_info'}->{'extension_undef'} = [
+  {
+    'error_line' => 'warning: document without Top node
+',
+    'file_name' => 'extension_undef.texi',
+    'text' => 'document without Top node',
+    'type' => 'warning'
+  }
+];
+
+
+1;
diff --git 
a/tp/t/results/converters_tests/extension_undef/res_docbook/extension_undef 
b/tp/t/results/converters_tests/extension_undef/res_docbook/extension_undef
new file mode 100644
index 0000000000..b1baa0beac
--- /dev/null
+++ b/tp/t/results/converters_tests/extension_undef/res_docbook/extension_undef
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"; [
+  <!ENTITY tex "TeX">
+  <!ENTITY latex "LaTeX">
+]>
+<book id="extension_undef" lang="en">
+<chapter label="">
+<title>top</title>
+
+</chapter>
+<chapter label="1" id="chapter">
+<title>Chap</title>
+</chapter>
+</book>
diff --git a/tp/t/results/converters_tests/extension_undef/res_html/chapter 
b/tp/t/results/converters_tests/extension_undef/res_html/chapter
new file mode 100644
index 0000000000..edd143c5d3
--- /dev/null
+++ b/tp/t/results/converters_tests/extension_undef/res_html/chapter
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>chapter (top)</title>
+
+<meta name="description" content="chapter (top)">
+<meta name="keywords" content="chapter (top)">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="#chapter" rel="start" title="chapter">
+<style type="text/css">
+<!--
+a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
+span:hover a.copiable-link {visibility: visible}
+-->
+</style>
+
+
+</head>
+
+<body lang="en">
+<p>node Top
+</p><div class="top-level-extent" id="top">
+<h1 class="top"><span>top<a class="copiable-link" href="#top"> 
&para;</a></span></h1>
+
+<ul class="mini-toc">
+<li><a href="#chapter" accesskey="1">Chap</a></li>
+</ul>
+<div class="chapter-level-extent" id="chapter">
+<h2 class="chapter" id="Chap"><span>1 Chap<a class="copiable-link" 
href="#Chap"> &para;</a></span></h2>
+</div>
+</div>
+
+
+
+</body>
+</html>
diff --git 
a/tp/t/results/converters_tests/extension_undef/res_info/extension_undef 
b/tp/t/results/converters_tests/extension_undef/res_info/extension_undef
new file mode 100644
index 0000000000..78ed054ab4
--- /dev/null
+++ b/tp/t/results/converters_tests/extension_undef/res_info/extension_undef
@@ -0,0 +1,23 @@
+This is extension_undef, produced from extension_undef.texi.
+
+node Top
+
+top
+***
+
+
+File: extension_undef,  Node: chapter
+
+1 Chap
+******
+
+
+Tag Table:
+Node: chapter81
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
diff --git 
a/tp/t/results/converters_tests/extension_undef/res_latex/extension_undef 
b/tp/t/results/converters_tests/extension_undef/res_latex/extension_undef
new file mode 100644
index 0000000000..a45e179e03
--- /dev/null
+++ b/tp/t/results/converters_tests/extension_undef/res_latex/extension_undef
@@ -0,0 +1,50 @@
+\documentclass{book}
+\usepackage{amsfonts}
+\usepackage{amsmath}
+\usepackage[gen]{eurosym}
+\usepackage{textcomp}
+\usepackage{graphicx}
+\usepackage{etoolbox}
+\usepackage{titleps}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{float}
+% use hidelinks to remove boxes around links to be similar to Texinfo TeX
+\usepackage[hidelinks]{hyperref}
+
+\makeatletter
+\newcommand{\Texinfosettitle}{No Title}%
+
+% redefine the \mainmatter command such that it does not clear page
+% as if in double page
+\renewcommand\mainmatter{\clearpage\@mainmattertrue\pagenumbering{arabic}}
+\newenvironment{Texinfopreformatted}{%
+  \par\GNUTobeylines\obeyspaces\frenchspacing\parskip=\z@\parindent=\z@}{}
+{\catcode`\^^M=13 \gdef\GNUTobeylines{\catcode`\^^M=13 \def^^M{\null\par}}}
+\newenvironment{Texinfoindented}{\begin{list}{}{}\item\relax}{\end{list}}
+
+% used for substitutions in commands
+\newcommand{\Texinfoplaceholder}[1]{}
+
+\newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
+                              {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
+
+% allow line breaking at underscore
+\let\Texinfounderscore\_
+\renewcommand{\_}{\Texinfounderscore\discretionary{}{}{}}
+\renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
+
+\makeatother
+% set default for @setchapternewpage
+\makeatletter
+\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{\Texinfoplaceholder{setchapternewpage
 placeholder}\clearpage}{}{}
+\makeatother
+\pagestyle{single}%
+
+\begin{document}
+node Top
+\part*{{top}}
+
+\chapter{{Chap}}
+\label{anchor:chapter}%
+\end{document}
diff --git 
a/tp/t/results/converters_tests/extension_undef/res_xml/extension_undef 
b/tp/t/results/converters_tests/extension_undef/res_xml/extension_undef
new file mode 100644
index 0000000000..0599928756
--- /dev/null
+++ b/tp/t/results/converters_tests/extension_undef/res_xml/extension_undef
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE texinfo PUBLIC "-//GNU//DTD TexinfoML V7.1//EN" 
"http://www.gnu.org/software/texinfo/dtd/7.1/texinfo.dtd";>
+<texinfo>
+<filename file="extension_undef"></filename>
+<para>node Top
+</para><top spaces=" "><sectiontitle>top</sectiontitle>
+
+</top>
+<node name="chapter" spaces=" "><nodename>chapter</nodename></node>
+<chapter spaces=" "><sectiontitle>Chap</sectiontitle>
+</chapter>
+</texinfo>
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index f1676116f2..eeeaae9729 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1272,7 +1272,7 @@ sub test($$)
                                   $document, $format_converter_options);
       $converted_errors{$format} = undef if (!@{$converted_errors{$format}});
 
-      if ($format =~ /^file_/ and defined ($converted{$format})) {
+      if ($format =~ /^file_/ and defined($converted{$format})) {
         # This is certainly wrong, because the differences are made on
         # the output files which should be empty.  Differences in output
         # will be missed.  It is tempting to use such format to have



reply via email to

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