info_tests.t 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  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 $invalid_node_name_text = '
  6. @node Top
  7. @menu
  8. * @asis{truc:}: @asis{nodename. a}
  9. * machin: node@comma{}comma, def
  10. * @asis{bidule:}::
  11. @end menu
  12. @node @asis{nodename. a}
  13. @node node@comma{}comma
  14. @node @asis{bidule:}
  15. @ref{@asis{nodename. a}, @asis{truc:}}. @ref{node@comma{}comma, machin}.
  16. @ref{@asis{bidule:}}.
  17. ';
  18. my @test_cases = (
  19. ['no_nodes',
  20. 'Text.'],
  21. ['no_top_node',
  22. '@node node Top not Top node
  23. '],
  24. ['paragraphindent_and_preamble',
  25. '@copying
  26. In copying.
  27. Copying second para.
  28. @end copying
  29. @node Top
  30. @top test @@paragraphindent effect in preamble
  31. First para.
  32. Before paragraphindent.
  33. @paragraphindent 1
  34. After paragraphindent.
  35. @bye
  36. '],
  37. ['paragraphindent_asis_first',
  38. '
  39. bbb
  40. @paragraphindent asis
  41. ccc
  42. '],
  43. ['paragraphindent_none_first',
  44. '
  45. first
  46. second
  47. @paragraphindent none
  48. after none
  49. '],
  50. ['space_at_menu_end',
  51. '@node Top
  52. @menu
  53. * (out)::
  54. @end menu
  55. A para.
  56. '],
  57. ['space_in_menu',
  58. '@node Top
  59. @top Element
  60. Text.
  61. @menu
  62. * node::
  63. @end menu
  64. @node node
  65. @chapter node
  66. in chapter.
  67. '],
  68. ['text_before_node',
  69. '@node Top
  70. @top top
  71. @menu
  72. * chapter node::
  73. @end menu
  74. text.
  75. @node chapter node
  76. @chapter chapter'
  77. ],
  78. ['ref_tests',
  79. '
  80. @node Top
  81. @ref{(m)in ref followed by comma},
  82. @ref{(m)in ref not followed by comma} after ref.
  83. @code{@ref{(m)in ref followed by end command}}.
  84. @ref{(m)in ref followed by comma, name},
  85. @ref{(m)in ref not followed by comma, name} after ref.
  86. @code{@ref{(m)in ref followed by end command, name}}.
  87. @ref{(m)in ref ending with a dot., name} after ref.
  88. '],
  89. ['xref_test',
  90. '
  91. @node Top
  92. @xref{(m)in xref}. @xref{(m)bad xref} after xref.
  93. @code{@xref{(m)bad nested xref}}.
  94. @xref{(m)in ref ending with a dot., name} ! after xref and dot inside.
  95. @xref{(m)in ref followed by symbol}# g.
  96. '],
  97. ['pxref_test',
  98. '@node Top
  99. Hey (@pxref{(m) in pxref}) and continue (@pxref{(m) in pxref, name}) and end.
  100. @pxref{(m) n}. @pxref{(m) n, name}.
  101. '],
  102. ['contents_setcontentsaftertitlepage_before_node',
  103. '
  104. @contents
  105. @setcontentsaftertitlepage
  106. @node Top
  107. @top Double contents
  108. '],
  109. ['anchor_in_command',
  110. '@node Top
  111. @strong{aaa @TeX{} @emph{in emph} after
  112. @c emph @emph{emph2 @anchor{anchor in emph} }}.
  113. emph @emph{emph2 @anchor{anchor in emph}}}.
  114. '],
  115. ['anchor_and_spaces',
  116. '@node Top
  117. @top Element
  118. @anchor{anchor 0}
  119. Now @anchor{anchor1}.
  120. No space@anchor{anchor2}.
  121. '],
  122. ['before_node_and_section',
  123. 'Garbage
  124. ref to Top @ref{Top}.
  125. @cindex index entry before anything
  126. Hey@footnote{a footnote}.
  127. An anchor @anchor{anchor1}.
  128. @menu
  129. * node1::
  130. @end menu
  131. @node Top
  132. @top top @@top section
  133. Node top
  134. ref to anchor1@footnote{another footnote}, which is before @@node Top: @ref{anchor1}.
  135. @menu
  136. * node1::
  137. @end menu
  138. @node node1
  139. @chapter node1 chapter
  140. @printindex cp
  141. '],
  142. ['image_quotes',
  143. '@node Top
  144. @image{f--ile,,,alt""\\}
  145. '],
  146. ['image_in_paragraph',
  147. '@node Top
  148. Para.
  149. @image{f--ile,,,alt""\\}. End para.
  150. '],
  151. ['image_not_found',
  152. '@node Top
  153. @image{n_f_image}
  154. '],
  155. ['image_file_search',
  156. '@node Top
  157. @c does not work in the standalone perl module
  158. @c @image{tp/t/include_dir/f--ile}
  159. @@image dot.
  160. @image{./tp/t/include_dir/f--ile}
  161. @@image dot parent.
  162. @image{../include_dir/f--ile}
  163. ',{'include_directories' => ['.', '..', 't/include_dir']}],
  164. ['image_extension',
  165. '@node Top
  166. @image{fext,,,,ext}
  167. @image{fdotext,,,,ext}
  168. @image{f--ile,,,,ext}
  169. '],
  170. ['image_text_encoded',
  171. '@documentencoding utf-8
  172. @image{image_encoded}
  173. '],
  174. ['image_and_spaces_formatting',
  175. '@node Top
  176. @image{words} @image{words} @image{words} @image{words} @image{words} @image{words} @image{words}
  177. Some text @image{words} @image{words} @image{words} @image{words} @image{words} @image{words} @image{words}.
  178. Some text @image{words} text aaaaaaaaa @image{words} text bbbbbbbbbbb @image{words} text ccccccccccccc @image{words} text ddddddddddddd @image{words} text eeeeeeeeeeeeeee @image{words} text fffffffffff @image{words}.
  179. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @image{words}
  180. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBB @image{words}
  181. Text. @image{words} @image{words}.
  182. '],
  183. ['image_and_punctuation',
  184. '@node Top
  185. One space. @image{f--ile}.
  186. Two spaces. @image{f--ile}.
  187. End line.
  188. @image{f--ile}.
  189. One space. @image{words}.
  190. Two spaces. @image{words}.
  191. End line.
  192. @image{words}.
  193. '],
  194. [ 'multitable_anchor_and_index_entry',
  195. '@node Top
  196. @multitable @columnfractions 0.4 0.6
  197. @headitem mu--ltitable headitem @tab another tab
  198. @item mu--ltitable item @tab multitable tab
  199. @c comment in multitable
  200. @item mu--ltitable item 2 @tab multitable tab 2
  201. @cindex index entry within multitable
  202. @anchor{anchor in multitable}
  203. @item lone mu--ltitable item
  204. @end multitable
  205. @multitable {A} {B}
  206. @item A
  207. B
  208. C
  209. @tab G
  210. @item lsfd mlkdsf lk s
  211. mlsdmjlfdsjm mdsfk
  212. @cindex index entry
  213. @item lsfd2 mlkdsf2 lk2 s2
  214. mlsdmjlfdsjm mdsfk2
  215. @tab ATTTTTTTTTTTTTTTTTTTTT
  216. BTTTTTTt @anchor{mark}
  217. CTTTTTT
  218. @end multitable
  219. @printindex cp
  220. @ref{mark}
  221. @ref{anchor in multitable}
  222. '],
  223. ['note_in_strong',
  224. '@node Top
  225. 3 One @strong{Note}.
  226. 5 @strong{Note a}.
  227. 9 @strong{note}.
  228. 11 @strong{note b}.
  229. 13 @strong{ note}.
  230. 15 @strong{note-bbb}.
  231. '],
  232. ['note_in_strong_end_of_line',
  233. '@node Top
  234. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb vvvvvvvvvvvvvvvv @strong{note a}
  235. bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb vvvvvvvvvvvvvvvv @strong{note
  236. a}
  237. '],
  238. ['nested_multitable_anchor_index',
  239. '@node Top
  240. @multitable {truc AAAA machin} {bidule}
  241. @item
  242. @multitable {AAAA} {machin}
  243. @item AAAA @tab machin @anchor{mark inside}
  244. @cindex index entry inside
  245. @end multitable
  246. @tab bidule
  247. @item other item @tab in tab @anchor{mark}
  248. @cindex index entry
  249. @end multitable
  250. @printindex cp
  251. @xref{mark}.
  252. @xref{mark inside}.
  253. '],
  254. ['def_in_copying',
  255. '@macro mymacro
  256. @deffn aa bb cc
  257. @deffnx aax bbx ccx
  258. deffnx lines
  259. @end deffn
  260. @end macro
  261. @node Top
  262. @top Test for definition commands
  263. @copying
  264. In copying
  265. @mymacro{}
  266. @end copying
  267. In text
  268. @mymacro{}
  269. @printindex fn
  270. '],
  271. ['file_only_png',
  272. '@node Top
  273. Just before an image @image{this_is_a_long_unknown_file} text after the image, and more text, and more @image{this_is_a_long_unknown_file} text.
  274. '],
  275. ['float_long_captions',
  276. '@node Top
  277. @float Text, text1
  278. @caption{AAAAAAAAAAAAAAAA BBBBB CCCCCCCCCCC}
  279. @end float
  280. @float Text, text2
  281. @caption{AAAAAAAAAAAAAAAA BBBBBB CCCCCCCCCCC}
  282. @end float
  283. @listoffloats Text
  284. '],
  285. ['error_in_footnote',
  286. '
  287. @node Top
  288. @float Text, label
  289. Float text1
  290. @caption{Caption. @TeX.
  291. In caption @strong{note caption}.
  292. Now footnote@footnote{@LaTeX.
  293. and strong @strong{Note footnote}.}}
  294. @end float
  295. @listoffloats Text
  296. @listoffloats Text
  297. '],
  298. ['nested_footnotes_separate',
  299. '@footnotestyle separate
  300. @node Top
  301. F@footnote{F1
  302. V@footnote{F2}
  303. }
  304. '],
  305. ['encoding_us_ascii',
  306. '
  307. @documentencoding US-ASCII
  308. @node Top
  309. '],
  310. ['known_encoding',
  311. '
  312. @documentencoding latin1
  313. @node Top
  314. '],
  315. ['unknown_encoding',
  316. '
  317. @documentencoding ggg
  318. @node Top
  319. '],
  320. ['top_node_normalization',
  321. '@node ToP
  322. @xref{TOP}. @xref{tOP}.
  323. @menu
  324. * tOP::
  325. @end menu
  326. '],
  327. # since there is no split in the test suite, there is no split tested
  328. # here, in fact.
  329. ['split_no_copying',
  330. '\input texinfo
  331. @setfilename split-nocopying.info
  332. @node Top
  333. @top Top
  334. This is the top node.
  335. @menu
  336. * Ch1::
  337. @end menu
  338. @node Ch1
  339. @chapter Ch1
  340. First chapter.
  341. @bye
  342. ',{},{'SPLIT_SIZE' => 10}],
  343. ['no_node_but_top',
  344. '@top top
  345. '],
  346. ['space_in_setfilename',
  347. '@setfilename @ @verb{: name :}@
  348. @node Top
  349. '],
  350. ['novalidate_empty_refs',
  351. '
  352. @novalidate
  353. @node Top
  354. @xref{@:}.
  355. @xref{@asis{ }}.
  356. @node @
  357. @node @:
  358. @node @asis{ }
  359. '],
  360. ['invalid_node_name_warning',
  361. $invalid_node_name_text
  362. ],
  363. ['invalid_node_name_no_warning',
  364. $invalid_node_name_text,
  365. {},{'INFO_SPECIAL_CHARS_WARNING' => 0}
  366. ],
  367. ['only_documentencoding',
  368. '@documentencoding ISO-8859-1'],
  369. ['direntry_dircategory_and_commands',
  370. '@dircategory ``category---@var{th ere}?\'\'
  371. @direntry
  372. * foo: (foo). ``hello---@var{there}?\'\'
  373. @end direntry
  374. @dircategory cat2
  375. @direntry
  376. * aaa :: aaaa
  377. bbbbb
  378. menutitle
  379. @end direntry
  380. @node Top
  381. @top Test dircategory and direntry
  382. Text
  383. '],
  384. ['colon_in_index_entry',
  385. '@node Top
  386. @synindex vr cp
  387. @cindex a:b
  388. @vtable @emph
  389. @item %main::value
  390. @end vtable
  391. @defvr {a:b} {c:d} e f
  392. @defvrx {x:y} {z:t} n m o
  393. @end defvr
  394. @printindex cp
  395. '],
  396. ['test_index',
  397. '@node Top
  398. @top Element top
  399. @xref{a counting anchor}.
  400. before menu.
  401. @cindex in Top
  402. @cindex @@
  403. @cindex @exclamdown{}
  404. @cindex "
  405. @deffn fset @var{i} a g
  406. @deffnx truc machin bidule chose
  407. @end deffn
  408. @ftable @emph
  409. @item a fun
  410. Var text
  411. @item second fun
  412. @itemx itemx fun
  413. @end ftable
  414. @menu
  415. * name::
  416. * name1 looooooooooooooooooooooooooooooooooooooooooooooooooooooooong::
  417. @end menu
  418. @node name
  419. @chapter A chapter
  420. @cindex index entry looooooooooooooooooooooooooooooooooooooooooooooooooooooooong
  421. @findex function index entry
  422. A paragraph
  423. @findex other function
  424. end paragraph
  425. a
  426. a
  427. a
  428. a
  429. a
  430. @findex after lines.
  431. b
  432. b
  433. b
  434. b
  435. b
  436. b
  437. b
  438. b
  439. b
  440. b
  441. b
  442. b
  443. b
  444. b
  445. b
  446. b
  447. b
  448. b
  449. b
  450. b
  451. b
  452. b
  453. b
  454. b
  455. b
  456. b
  457. b
  458. b
  459. b
  460. b
  461. b
  462. b
  463. b
  464. b
  465. b
  466. b
  467. b
  468. b
  469. b
  470. b
  471. b
  472. b
  473. b
  474. b
  475. b
  476. b
  477. b
  478. b
  479. b
  480. b
  481. b
  482. b
  483. b
  484. b
  485. b
  486. b
  487. b
  488. b
  489. b
  490. b
  491. b
  492. b
  493. b
  494. b
  495. b
  496. b
  497. b
  498. b
  499. b
  500. b
  501. b
  502. b
  503. b
  504. b
  505. b
  506. @findex after more than 100 lines
  507. @node name1 looooooooooooooooooooooooooooooooooooooooooooooooooooooooong
  508. @appendix Index
  509. @cindex index entry in appendix before para
  510. Para.
  511. Concept index
  512. @printindex cp
  513. @findex index entry between indices
  514. Functions index
  515. @printindex fn
  516. @appendixsec appendixsec
  517. @appendixsubsec appendixsubsec
  518. @appendixsubsubsec appendixsubsubsec
  519. @chapheading chapheading
  520. @centerchap centerchap
  521. @chapter chapter end
  522. @cindex index in chapter end
  523. @anchor{a counting anchor}
  524. @bye
  525. '],
  526. ['index_entry_at_end_node',
  527. '@node Top
  528. @top Element
  529. @menu
  530. * chapter::
  531. * indices::
  532. @end menu
  533. @node chapter
  534. @chapter Chapter
  535. @cindex index entry
  536. @node indices
  537. @appendix indices
  538. @printindex cp
  539. '],
  540. ['center_flush',
  541. '@center centered
  542. @flushleft
  543. left and
  544. left2
  545. left3.
  546. left Last
  547. with space.
  548. Now anchor
  549. @anchor{anchor in flushleft}
  550. after anchor
  551. @end flushleft
  552. @flushright
  553. right and
  554. right2
  555. Right3
  556. Right last
  557. with space.
  558. Now anchor
  559. @anchor{anchor in flushright}
  560. after anchor
  561. Second anchor in text @anchor{second anchor in flushright} after anchor.
  562. @end flushright
  563. '],
  564. # if this test is changed, the corresponding test in t/plaintext_tests.t
  565. # should be changed too
  566. ['multiline_image_and_align',
  567. '@center @image{figure}
  568. @center CCCC @image{figure}
  569. @center fffffffffffffffffffffffffffffffffffffff @image{figure}
  570. @center dddd @image{figure} iiiii
  571. @flushright
  572. AAA
  573. @image{figure}
  574. BBB @image{figure} gggg @image{figure}
  575. HHH
  576. @image{figure} JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
  577. @end flushright
  578. @center @image{figure, , , ,txt}
  579. @center CCCC @image{figure, , , ,txt}
  580. @center fffffffffffffffffffffffffffffffffffffff @image{figure, , , ,txt}
  581. @center dddd @image{figure, , , ,txt} iiiii
  582. @flushright
  583. AAA
  584. @image{figure, , , ,txt}
  585. BBB @image{figure, , , ,txt} gggg @image{figure, , , ,txt}
  586. HHH
  587. @image{figure, , , ,txt} JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
  588. @end flushright
  589. '],
  590. );
  591. my @file_tests = (
  592. ['split_test_before_first_node',
  593. '@setfilename split_test_before_first_node.info
  594. truc machin et reuc machin ze aze zea zae eaz eaz zae
  595. @node Top
  596. @top top
  597. In top node
  598. @menu
  599. * chap1::
  600. @end menu
  601. @node chap1
  602. @chapter chap
  603. In chap1.
  604. ',{},{'SPLIT_SIZE' => 10}],
  605. ['split_test_before_first_node_no_empty_line',
  606. '@setfilename split_test_before_first_node.info
  607. truc machin et reuc machin ze aze zea zae eaz eaz zae
  608. @node Top
  609. @top top
  610. In top node
  611. @menu
  612. * chap1::
  613. @end menu
  614. @node chap1
  615. @chapter chap
  616. In chap1.
  617. ',{},{'SPLIT_SIZE' => 10}],
  618. );
  619. foreach my $test (@test_cases) {
  620. push @{$test->[2]->{'test_formats'}}, 'info';
  621. }
  622. foreach my $test (@file_tests) {
  623. push @{$test->[2]->{'test_formats'}}, 'file_info';
  624. }
  625. our ($arg_test_case, $arg_generate, $arg_debug);
  626. run_all ('info_tests', [@test_cases, @file_tests], $arg_test_case,
  627. $arg_generate, $arg_debug);
  628. 1;