57invalid_nestings.t 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. use strict;
  2. use File::Spec;
  3. BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }
  4. require 't/test_utils.pl';
  5. my @test_cases = (
  6. ['on_section_line',
  7. '@section @noindent Text @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote} @exdent exdent
  8. '],
  9. ['on_node_line',
  10. '@node @ref{a, b, c, filename}, (@pxref{(somemanual)Top}) @anchor{in anchor}@footnote{footnote} @exdent exdent
  11. '],
  12. ['on_subheading_line',
  13. '@subheading @noindent Text @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote} @exdent exdent
  14. '],
  15. ['on_block_command_line',
  16. '@multitable {@anchor{in anchor}} @titlefont{in titlefont}
  17. @item @titlefont{in titlefont}
  18. @end multitable
  19. @quotation @indent @titlefont{in titlefont} @anchor{in quotation anchor}@footnote{footnote} @exdent exdent
  20. @end quotation
  21. '],
  22. ['on_def_line',
  23. '@deffn {@anchor{in anchor}} @titlefont{in titlefont} @footnote{footnote} @exdent exdent
  24. @deffnx {@anchor{in anchorx}} @titlefont{in titlefontx} @footnote{footnotex} @exdent exdentx
  25. @end deffn
  26. '],
  27. ['raw_block_on_line',
  28. '@cindex @tex
  29. ',
  30. {'expanded_formats' => ['tex']}
  31. ],
  32. ['ignored_text',
  33. '@node before ignore @ifinfo
  34. in ifinfo
  35. @end ifinfo on the node line',
  36. {'expanded_formats' => []}
  37. ],
  38. ['in_table',
  39. '
  40. @node Top
  41. @table @xref
  42. @end table
  43. @table @code
  44. @item @indent @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote} @exdent exdent
  45. in item@footnote{footnote in item}
  46. @item @ref{Top,, title
  47. long title}
  48. @item @center centered text in item
  49. @item @cindex index
  50. @end table
  51. @vtable @asis
  52. @item @cindex index
  53. @option{opt}
  54. More text
  55. @item @cindex 2 index
  56. @option{nopt}
  57. Even more
  58. @end vtable
  59. @printindex fn
  60. @printindex cp
  61. '],
  62. ['table_on_item_line',
  63. '@table @asis
  64. @item item @table @asis
  65. @item in nested table item
  66. in nested table line
  67. @end table
  68. in table line
  69. @end table
  70. '],
  71. ['on_itemize_line',
  72. '@itemize @indent @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote} @exdent exdent
  73. @item in item.
  74. @end itemize
  75. @itemize on line @item in item
  76. @end itemize
  77. '],
  78. ['on_index_entry_line',
  79. '@cindex @indent @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote} @exdent exdent
  80. '],
  81. ['section_on_index_entry_line',
  82. '@cindex a @section b
  83. Somethin
  84. '],
  85. ['node_on_index_entry_line',
  86. '
  87. @cindex entry @node a, (m)b, (m)c, (h)d
  88. Content
  89. '],
  90. ['section_on_def_line',
  91. '@deffn a b @section s
  92. Something
  93. @end deffn
  94. '],
  95. ['section_on_defx_line',
  96. '@deffn h j k l
  97. @deffnx a b @section s
  98. Something
  99. @end deffn
  100. '],
  101. ['center',
  102. '@center @indent @titlefont{in titlefont} @anchor{in anchor}@footnote{footnote}
  103. @center center @cindex cindex
  104. @center @quotation
  105. in quotation
  106. @end quotation
  107. @center center @center second center
  108. @center @code{in code in center
  109. }
  110. @center @code{in code in center @center center in code in center
  111. }
  112. @code{@center in center in code}
  113. @table @asis
  114. @center centered line with item @item first item on center line
  115. @end table
  116. @table @emph
  117. @item item
  118. @center centered line with item @item second item on center line
  119. @end table
  120. Empty double center:
  121. @center @center
  122. @center @samp{something @center end of samp}
  123. @center after first center @samp{@center after second center
  124. End of samp}
  125. @multitable {AAA} {BBB}
  126. @item truc @tab bidule
  127. @center @item ctruc @tab cbidule
  128. @center @item cstruc
  129. @end multitable
  130. @center before the table @table @asis
  131. @item item in center
  132. Line in center
  133. @item second item
  134. @end table
  135. '],
  136. ['accents',
  137. 'Valid
  138. @~{@TeX{}}. @~{@@}.
  139. Invalid
  140. @~{@code{a}}. @^{@anchor{truc}}.
  141. '],
  142. ['block_not_matching',
  143. '@quotation
  144. A quotation
  145. @end cartouche
  146. @deffn {Function Reference} print_navigation $filehandle
  147. Text
  148. @end deftypefun
  149. @table @asis
  150. @item item
  151. line
  152. @end vtable
  153. @table @emph
  154. @item ref
  155. @example
  156. example
  157. @end display
  158. @end table
  159. @group
  160. in group
  161. @end table
  162. @group
  163. in group 2
  164. @end cartouche
  165. @cartouche
  166. cartouche
  167. @end group
  168. @cartouche
  169. carouche
  170. @end float
  171. '],
  172. ['bad_style_nesting',
  173. '@code{
  174. @quotation
  175. in quotation}
  176. @end quotation
  177. '],
  178. ['bad_tab_nesting',
  179. '@multitable {truc} {bidule}
  180. @item truc
  181. @code{@tab bidule}
  182. @end multitable
  183. '],
  184. ['tab_in_index',
  185. '@multitable {one nonlettered character} {normal text}
  186. @item one nonlettered character @tab aaa
  187. @vindex in index entry @tab in tab
  188. @end multitable
  189. '],
  190. ['multitable_item_in_index',
  191. '@multitable {aaa} {bbb}
  192. @vindex @item on item line
  193. @end multitable
  194. '],
  195. ['style_not_closed_no_newline_root_commands',
  196. '@node Top
  197. @top top
  198. @menu
  199. * chapter::
  200. @end menu
  201. @code{not closed
  202. @node chapter
  203. @chapter chapter
  204. @code{still not closed
  205. @bye
  206. '],
  207. ['style_not_closed_root_commands',
  208. '@node Top
  209. @top top
  210. @menu
  211. * chapter::
  212. @end menu
  213. @code{not closed
  214. @node chapter
  215. @chapter chapter
  216. @code{still not closed
  217. @bye
  218. '],
  219. ['style_not_closed_before_first_node',
  220. '@code{in code
  221. @node Top
  222. In node
  223. '],
  224. ['style_not_closed_in_block_command',
  225. '@cartouche
  226. cartouche @code{in code
  227. @end cartouche
  228. '],
  229. ['style_not_closed_in_table_line',
  230. '@table @asis
  231. @item first item
  232. line
  233. line @code{in code @item in item
  234. @end table
  235. '],
  236. ['formats_not_closed_in_example',
  237. '@example
  238. @table @asis
  239. @item item
  240. table line
  241. Some text.
  242. @enumerate
  243. @item first item
  244. @item an item
  245. @end example
  246. '],
  247. ['section_in_table',
  248. '@table @asis
  249. @item Before
  250. @section Subsection
  251. @item After
  252. @end table
  253. '],
  254. ['section_in_flushright',
  255. '@flushright
  256. text flushed right
  257. @section a section
  258. '],
  259. ['section_in_copying',
  260. '@copying
  261. in copying
  262. @section section
  263. '],
  264. ['section_in_nested_block_commands',
  265. '@table @strong
  266. @item item
  267. table line
  268. @quotation
  269. in quotation
  270. @section a section
  271. '],
  272. ['section_in_footnote',
  273. '
  274. Text@footnote{
  275. @section a section
  276. '],
  277. ['section_in_math',
  278. '
  279. Some @math{aa {x^2
  280. @section sec1
  281. More @math{ in math
  282. @section sec2
  283. '],
  284. ['itemx_in_itemize_enumerate_in_table',
  285. '@table @strong
  286. @item item
  287. In item, nested itemize
  288. @itemize
  289. @itemx in nested itemize itemx
  290. @end itemize
  291. @enumerate
  292. @itemx in nested enumerate itemx
  293. @end enumerate
  294. @end table
  295. '],
  296. ['item_tab_outside_of_table_lists',
  297. '@itemx itemx outside.
  298. @headitem headitem outside.
  299. @someitem someitem outside.
  300. @tab tab outside
  301. '],
  302. ['node_in_copying',
  303. '@copying
  304. @node node
  305. @end copying
  306. '],
  307. ['node_in_copying_not_closed',
  308. '@copying
  309. This is an unterminatted copyright notice
  310. @node Top
  311. @top Top section
  312. @insertcopying
  313. '],
  314. ['table_not_closed_in_menu_description',
  315. '@menu
  316. * (gcc):: text @table @asis
  317. @item item
  318. table line
  319. @end menu
  320. '],
  321. ['table_not_closed_in_menu_comment',
  322. '@menu
  323. * (manual):: desc
  324. @table @asis
  325. @item item
  326. comment
  327. * (manual2)::
  328. @end menu
  329. '],
  330. ['def_not_closed_in_menu_description',
  331. '@menu
  332. * (info):: before deff @deffn bidule truc chose
  333. deffn text
  334. @end menu
  335. '],
  336. ['recursive_copying',
  337. '@copying
  338. In copying.
  339. @insertcopying
  340. @end copying
  341. @insertcopying
  342. '],
  343. ['unclosed_verb_on_misc_line',
  344. '@setfilename name @verb{file.texi'],
  345. ['unclosed_verb_on_section_line',
  346. '@section in section @verb{Truc
  347. Now text.
  348. '],
  349. ['unclosed_verb_end_of_line_on_misc_line',
  350. '@setfilename name @verb{
  351. '],
  352. ['cartouche_in_style_command',
  353. '@code{
  354. @cartouche
  355. cartouche
  356. @end cartouche
  357. }
  358. '],
  359. ['multitable_in_style_command',
  360. '@code{
  361. Multitable
  362. @multitable {truc} {machin}
  363. @item truc @tab machin
  364. @end multitable
  365. }'],
  366. ['enumerate_in_style_command',
  367. '@code{
  368. @enumerate 1
  369. @item item
  370. @end enumerate
  371. }'],
  372. ['quotation_in_style_command',
  373. '@code{
  374. @quotation
  375. a quotation
  376. @end quotation
  377. }'],
  378. ['def_in_style_command',
  379. '@code{
  380. @defun name args...
  381. text
  382. @end defun
  383. }'],
  384. ['flushright_in_style_command',
  385. '@code{
  386. @flushright
  387. in flushright
  388. @end flushright
  389. }'],
  390. ['example_in_style_command',
  391. '@code{
  392. @example
  393. example
  394. @end example
  395. }'],
  396. ['float_in_style_command',
  397. '@code{
  398. @float A, B
  399. in float
  400. @caption{Caption}
  401. @end float
  402. }'],
  403. ['menu_in_style_command',
  404. '@node Top
  405. @code{
  406. @menu
  407. * (truc)::
  408. @end menu
  409. }'],
  410. ['item_in_ref',
  411. '@table @asis
  412. @item first item
  413. First item text
  414. @ref{Top,, title in first item
  415. @item second item}
  416. @end table
  417. '],
  418. ['ref_in_anchor',
  419. '@node Top
  420. @anchor{TOP @ref{Top}}'],
  421. ['ref_in_ref',
  422. '@node Top
  423. @ref{@ref{Top}}'],
  424. ['footnote_in_ref',
  425. '@node Top
  426. @xref{Top, Text@footnote{First para
  427. seond para}.'],
  428. ['verbatim_in_ref',
  429. '@node Top
  430. @xref{Top,
  431. @verbatim
  432. verbat text
  433. @end verbatim
  434. }.'],
  435. ['quotation_in_ref',
  436. '@node Top
  437. @xref{Top,
  438. @quotation
  439. quotation in ref
  440. @end quotation
  441. }.
  442. '],
  443. ['ignore_in_xref',
  444. '@node Top
  445. @xref{Top,
  446. @ignore
  447. ignore me
  448. @end ignore
  449. }.
  450. '],
  451. ['in_errormsg',
  452. '
  453. @anchor{in ref}
  454. Text. @errormsg{@anchor{in anchor} @ref{in ref}}
  455. @errormsg{
  456. @table @asis
  457. @item item
  458. @end table
  459. }'],
  460. );
  461. my @formatted_cases = (
  462. ['table_in_code',
  463. '@code{
  464. in code
  465. @table @emph
  466. @item line
  467. text
  468. @end table
  469. }
  470. '],
  471. );
  472. foreach my $test (@formatted_cases) {
  473. $test->[2]->{'test_formats'} = ['plaintext'];
  474. }
  475. our ($arg_test_case, $arg_generate, $arg_debug);
  476. run_all ('invalid_nestings', [@test_cases, @formatted_cases], $arg_test_case,
  477. $arg_generate, $arg_debug);