22xtable.t 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. ['accent_on_table_line',
  7. '@table @~
  8. @item first item
  9. @item no at-command @code{code}
  10. @end table
  11. '],
  12. ['definfoenclose_on_table_line',
  13. '@definfoenclose phi,:,:
  14. @table @phi
  15. @item item
  16. @itemx item x
  17. table content.
  18. @end table
  19. '],
  20. ['empty_item_itemx',
  21. '@vtable @asis
  22. VTable
  23. @item first item
  24. @itemx
  25. @itemx after an empty itemx, before an empty item
  26. @item
  27. @item in item before end table
  28. @end vtable
  29. '],
  30. ['long_item',
  31. '@table @emph
  32. @item first item aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa
  33. @itemx second itemx bbbbbbbbbbbbbbbbbbbbbbbbbbbbb b b b b b b b b b b b b b
  34. Text.
  35. @end table
  36. '],
  37. ['inter_item_commands_in_table',
  38. '@vtable @code
  39. @c comment in table
  40. @item a
  41. l--ine
  42. @end vtable
  43. @vtable @asis
  44. @item a
  45. @c comment between item and itemx
  46. @itemx b
  47. l--ine
  48. @end vtable
  49. @ftable @var
  50. @item a
  51. @cindex index entry between item and itemx
  52. @c and a comment
  53. @comment and another comment
  54. @itemx b
  55. l--ine
  56. @item c
  57. @c comment between lines
  58. @itemx d
  59. @c comment at end
  60. @end ftable
  61. @table @code
  62. @cindex cindex in table
  63. @c comment in table
  64. @item abb
  65. l--ine
  66. @end table
  67. @table @code
  68. @cindex cindex in table
  69. Texte before first item.
  70. @item abb
  71. @end table
  72. '],
  73. ['inter_item_commands_in_table_in_example',
  74. '@example
  75. @table @var
  76. @item a
  77. @cindex index entry between item and itemx
  78. @c and a comment
  79. @comment and another comment
  80. @itemx b
  81. @itemx c
  82. l--ine
  83. @item d
  84. @end table
  85. @end example
  86. '],
  87. ['block_commands_in_table',
  88. '@node Top
  89. @top Element
  90. @table @emph
  91. @item first item
  92. @itemx second itemx
  93. Text.
  94. @item example
  95. @example
  96. In example
  97. end example.
  98. @end example
  99. @item empty line
  100. empty line.
  101. @item quotation
  102. @quotation
  103. Quotation
  104. @end quotation
  105. @item quotation after a blank line
  106. @quotation
  107. quotation after a blank line
  108. @end quotation
  109. @end table
  110. @vtable @strong
  111. @item item before ignored lines
  112. @c comment
  113. @vindex vindex
  114. @itemx itemx now
  115. Description
  116. @end vtable
  117. @vtable @r
  118. @item item
  119. @itemx itemx after an empty line
  120. Description.
  121. @end vtable
  122. Something.
  123. @table @emph
  124. @item in item
  125. Text without blank line
  126. @item second item
  127. Text without blank line 2
  128. @end table
  129. After table.
  130. '],
  131. ['table_nested',
  132. '@macro myvtable
  133. @vtable @asis
  134. @item first item
  135. @itemx second itemx
  136. Text.
  137. @item second item
  138. Text 2
  139. @item last
  140. @end vtable
  141. Something.
  142. @table @emph
  143. @item in item
  144. Text without blank line
  145. @item second item
  146. Text without blank line 2
  147. @end table
  148. After table.
  149. @end macro
  150. Quotation
  151. @quotation
  152. @myvtable{}
  153. @end quotation
  154. Example
  155. @example
  156. @myvtable{}
  157. @end example
  158. Double quotation
  159. @quotation
  160. @quotation
  161. @myvtable{}
  162. @end quotation
  163. @end quotation
  164. '],
  165. ['comment_and_itemx_before_item',
  166. '@table @code
  167. @c comment
  168. @itemx in itemx
  169. @end table
  170. '],
  171. );
  172. my @test_invalid = (
  173. ['lone_end_table',
  174. 'Text.
  175. @end table
  176. '],
  177. ['invalid_command_and_brace_in_table',
  178. '@table @asis
  179. { @itemTop,, title
  180. long title}
  181. Item line
  182. @end table
  183. '],
  184. ['headitem_in_table',
  185. '@table @strong
  186. @headitem headitem in table
  187. headitem In table text.
  188. @item item
  189. @end table
  190. '],
  191. ['no_arg_brace_command_on_table_line',
  192. '@table @bullet
  193. @item item
  194. @end table
  195. '],
  196. ['no_argument_for_table',
  197. '@table
  198. @item item
  199. In item.
  200. @end table
  201. '],
  202. ['text_between_item_itemx',
  203. '@table @strong
  204. @item in item
  205. text
  206. @itemx in itemx
  207. @end table
  208. '],
  209. ['itemx_before_item',
  210. '@table @emph
  211. @itemx in itemx
  212. @end table
  213. '],
  214. ['title_and_itemx_before_item',
  215. '@table @emph
  216. Title
  217. @itemx in itemx
  218. @end table
  219. '],
  220. );
  221. foreach my $test (@test_cases) {
  222. push @{$test->[2]->{'test_formats'}}, 'plaintext';
  223. push @{$test->[2]->{'test_formats'}}, 'html_text';
  224. push @{$test->[2]->{'test_formats'}}, 'xml';
  225. }
  226. our ($arg_test_case, $arg_generate, $arg_debug);
  227. run_all ('xtable', [@test_cases, @test_invalid], $arg_test_case,
  228. $arg_generate, $arg_debug);