21multitable.t 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # Tests of some uses of @multitable
  2. use strict;
  3. use File::Spec;
  4. BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }
  5. require 't/test_utils.pl';
  6. my @test_cases = (
  7. ['not_letters_in_prototype',
  8. '@multitable 1.3 5-6
  9. @item 1.3 @tab 5-6
  10. @end multitable
  11. '],
  12. ['paragraph_in_cells',
  13. '@multitable {AAA} {BBB}
  14. @item truc @tab bidule
  15. @item begin item
  16. new paragraph in item.
  17. @tab begin tab
  18. new paragraph in tab.
  19. @end multitable'],
  20. ['multitable_in_example',
  21. '@example
  22. @multitable {AAA} {BBB}
  23. @item truc @tab bidule example
  24. @item begin item example
  25. new paragraph in item. example
  26. @tab begin tab example
  27. new paragraph in tab. example
  28. @end multitable
  29. @end example'],
  30. ['w_in_multitable',
  31. '@multitable {aaaaaaaaa} {bbbbbbbbbbb}
  32. @item @w{aaaaaaaa
  33. bbbbbbbbbb}
  34. @tab gg
  35. @end multitable
  36. '],
  37. ['inter_item_commands_in_multitable',
  38. '@multitable {truc}
  39. @c comment before first item
  40. @item truc
  41. @cindex index entry between empty lines
  42. @item trouc
  43. @c last comment
  44. @end multitable
  45. @multitable @columnfractions 0.6 0.4
  46. @headitem mu--ltitable headitem @tab another tab
  47. @item mu--ltitable item @tab multitable tab
  48. @c comment in multitable
  49. @item mu--ltitable item 2 @tab multitable tab 2
  50. @cindex index entry within multitable
  51. @item lone mu--ltitable item
  52. @end multitable
  53. @multitable {thing}
  54. Title
  55. @cindex cindex
  56. @item thing
  57. @end multitable
  58. '],
  59. ['empty_item_tab',
  60. '@multitable @columnfractions 1.0
  61. @item
  62. @item
  63. @item text
  64. @item
  65. @end multitable
  66. @multitable @columnfractions 0.5 0.5
  67. @item
  68. @item
  69. @item only item
  70. @item item text @tab
  71. @item item new line
  72. @tab
  73. @item @tab
  74. @item
  75. @tab
  76. @item not empty @tab tab not empty
  77. @end multitable
  78. '],
  79. ['prototype_brace_no_brace',
  80. '@multitable {aa} bb
  81. @end multitable
  82. '],
  83. ['prototype_brace_no_brace_comment',
  84. '@multitable {aa} bb@comment cc
  85. @end multitable
  86. '],
  87. ['prototype_no_brace',
  88. '@multitable aa@var{FF} b cc
  89. @end multitable
  90. '],
  91. ['multitable_with_empty_item_tab',
  92. '@multitable @columnfractions 0.3 0.7
  93. @item 1-1 @tab 1-2 @item@tab@item 3-1 @tab 3-2
  94. @end multitable
  95. '],
  96. # Check xrefs in a multitable are treated as if surrounded in @w { ... }.
  97. ['ref_in_multitable',
  98. '@novalidate
  99. @ref{XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX XXX XXX XXX XXX
  100. XXX XXX XXX XXX XXX XXX XXX XXX XX}.
  101. @multitable @columnfractions .35 .65
  102. @item XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX
  103. @tab See @ref{RRR RRR RRR RRR RRR RRR RRR RRR RRR RRRR}.
  104. @item XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX
  105. @tab See @ref{SSS SSS SSS SSS SSS SSS SSS SSS SSS SSS SSS SSS SSSSS}.
  106. @item adsf@footnote{@ref{XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX
  107. XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX}} @tab
  108. second column
  109. @end multitable
  110. @ref{XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX XXX XXX XXX XXX
  111. XXX XXX XXX XXX XXX XXX XXX XXX XX}.
  112. '],
  113. );
  114. my @test_invalid = (
  115. ['empty_multitable_with_cells',
  116. '@multitable
  117. @item item in empty multitable @tab tab in empty m @tab second tab in empty m
  118. @item item in empty m
  119. @end multitable
  120. '],
  121. ['multitable_one_column_too_much_cells',
  122. '@multitable {a}
  123. @item a @tab additional tab @tab other additional tab @tab 3rd additiona tab
  124. @item a1
  125. @item a2 @tab additional tab2 @tab other additional tab2 @tab 3rd additional tab2
  126. @item a3 @tab one additional tab
  127. @end multitable
  128. '],
  129. ['multitable_two_columns_too_much_cells',
  130. '@multitable @columnfractions 0.4 0.6
  131. @item first @tab second @tab first out @tab second out @tab third out
  132. @item first1
  133. @item first2 @tab second2 @tab first2 out
  134. @end multitable
  135. '],
  136. ['multitable_not_closed_item_tab',
  137. '@multitable {r} {t}
  138. @item rt @tab ds
  139. '],
  140. ['multitable_not_closed_item',
  141. '@multitable {r} {t}
  142. @item rt
  143. '],
  144. ['multitable_not_closed',
  145. '@multitable {r} {t}
  146. '],
  147. ['multitable_begin_with_tab',
  148. '@multitable {a} {b}
  149. @tab t
  150. @end multitable
  151. @multitable {c} {d}
  152. @tab t2
  153. @item it
  154. @end multitable
  155. '],
  156. );
  157. foreach my $test (@test_cases) {
  158. push @{$test->[2]->{'test_formats'}}, 'plaintext';
  159. push @{$test->[2]->{'test_formats'}}, 'html_text';
  160. push @{$test->[2]->{'test_formats'}}, 'xml';
  161. }
  162. our ($arg_test_case, $arg_generate, $arg_debug);
  163. run_all ('multitable', [@test_cases, @test_invalid], $arg_test_case,
  164. $arg_generate, $arg_debug);