50value.t 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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. [ 'simple', '@set a-_5b the value @b{b} @c comment
  7. @value{a-_5b} After value.
  8. '],
  9. ['not_only_characters',
  10. '@set -e_\'::; hh
  11. Say @value{-e_\'::;}.
  12. '],
  13. ['bad_syntax','
  14. @set
  15. @set
  16. @set ?
  17. @set :-/ hey!
  18. @set a@b
  19. @set :-" bad
  20. @set } no
  21. @clear aaa ggg
  22. @clear and{other
  23. @value{gurgl
  24. @value{unknown}
  25. '],
  26. ['spaces_before_value',
  27. '@set var val
  28. @value {var}
  29. '],
  30. ['comment_on_set_line',
  31. '@set x@c
  32. @set y @c
  33. @set z g@c
  34. @set t a vv @comment@ggg
  35. !@value{x}!, !@value{y}!, !@value{z}!, !@value{t}!
  36. '],
  37. ['value_zero',
  38. '@set zero 0
  39. Value
  40. @value{zero}'
  41. ],
  42. ['empty_set',
  43. '@set myspace
  44. 1 @value{myspace} 1
  45. '],
  46. ['empty_value_in_line',
  47. '@set myspace
  48. 1
  49. @value{myspace}
  50. 1
  51. '],
  52. ['value_in_node',
  53. '@set node1 Node 1
  54. @node Top, (dir), (dir), (dir)
  55. @top Expansion in Node Names
  56. @menu
  57. * @value{node1} ::
  58. @end menu
  59. @node @value{node1},, Top, Top
  60. @chapter Chapter 1
  61. @set sec1 Section 1.1
  62. @menu
  63. * @value{sec1}::
  64. @end menu
  65. @node Section 1.1, , Node 1, Node 1
  66. @xref{@value{node1}}.
  67. '],
  68. ['value_node_directions',
  69. '@set a--foo bar
  70. @node Top, @value{a--foo}, (dir), (dir)
  71. @top Var @value{a--foo}
  72. @value{a--foo}
  73. @node @value{a--foo}, BarFoo, Top, (dir)
  74. @chapter BarFoo
  75. @node BarFoo, , @value{a--foo}, (dir)
  76. @chapter bar
  77. '],
  78. ['value_after_accent',
  79. '@set a_letter a
  80. @ringaccent @value{a_letter}
  81. @~@value{a_letter}'
  82. ],
  83. ['value_in_index_commands',
  84. '@set cp cp
  85. @set fn fn
  86. @set syncodeindex_command @syncodeindex
  87. @syncodeindex @value{cp} @value{fn}
  88. @value{syncodeindex_command} cp fn
  89. @set truc truc
  90. definedx truc
  91. @defindex @value{truc}
  92. after
  93. @set trucindex_command @trucindex
  94. @set codeidx codeidx
  95. @defcodeindex @value{codeidx}
  96. @set defcodeindex_entry a @var{index entry} t@\'e @^{@dotless{i}}
  97. @node Top
  98. @value{trucindex_command} index truc
  99. @codeidxindex @value{defcodeindex_entry}
  100. @kindex @value{truc} kindex
  101. @pindex pindex @value{codeidx}
  102. value truc
  103. @printindex @value{truc}
  104. value cp
  105. @printindex @value{cp}
  106. '],
  107. ['value_in_misc_commands',
  108. '@set text atext
  109. @node Top
  110. @top top @value{text}
  111. @subheading Comment like: @value{text}
  112. Text line followed by a comment on the same line and another below @c comment @value{text}
  113. @c comment @value{text}
  114. @set pagesizes_arg 200mm,150mm
  115. @set afourpaper_macro @afourpaper
  116. @ifnottex
  117. @pagesizes @value{pagesizes_arg}
  118. @end ifnottex
  119. @value{afourpaper_macro}
  120. @headings on line following headings @value{text}
  121. @oddfooting some text ignored @value{text}
  122. @everyheading on line following everyheading @value{text}
  123. @set need_arg 0.1
  124. @ifnottex
  125. @need @value{need_arg}
  126. @end ifnottex
  127. @set raisesections_macro @raisesections
  128. @value{raisesections_macro}
  129. @set lowersections_macro @lowersections
  130. @value{lowersections_macro}
  131. @c tex error: Use of \ doesn\'t match its definition.
  132. @ifnottex
  133. @@definfoenclose phoo,//,\\\\ @definfoenclose phoo,//,\\\\
  134. @phoo{bar}
  135. @end ifnottex
  136. @set definfoenclose_name phi
  137. @definfoenclose @value{definfoenclose_name},:,:
  138. @phi{bar}
  139. @set strong_macro @strong
  140. @set strong_name strong
  141. @value{strong_macro}{very strong}
  142. @definfoenclose @value{strong_name},(@value{strong_name}:,:)
  143. @value{strong_macro}{ is it really strong? }
  144. @kbd{something before kbdinputstyle}
  145. @set kbdinputstyle_arg code
  146. @kbdinputstyle @value{kbdinputstyle_arg}
  147. @kbd{truc}
  148. @example
  149. @kbd{example}
  150. @end example
  151. @set asis_arg asis
  152. @set zero 0
  153. @set none_arg none
  154. @set four 4
  155. @set six 6
  156. @paragraphindent @value{asis_arg}
  157. @paragraphindent @value{zero}
  158. @paragraphindent @value{none_arg}
  159. @paragraphindent @value{four}
  160. @firstparagraphindent @value{none_arg}
  161. @exampleindent @value{six}
  162. @set end_arg end
  163. @set separate_arg separate
  164. @footnotestyle @value{end_arg}
  165. @footnotestyle @value{separate_arg}
  166. @set latin1 ISO-8859-1
  167. @documentencoding @value{latin1}
  168. @set en en
  169. @set documentlanguage_command @documentlanguage
  170. documentlanguage @documentlanguage @value{en}
  171. documentlanguage on its line
  172. @value{documentlanguage_command} en
  173. line following documentlanguage
  174. @set on_arg on
  175. @set off_arg off
  176. @frenchspacing @value{on_arg}
  177. @frenchspacing @value{off_arg}
  178. @c accepts 10 or 11
  179. @set ten 10
  180. @fonttextsize @value{ten}
  181. @c accept false or true
  182. @c makeinfo don\'t care about the arg and remove the remaining of the line
  183. @set false_arg false
  184. @set true_arg true
  185. @allowcodebreaks @value{false_arg}
  186. @allowcodebreaks @value{true_arg}
  187. @set page_macro @page
  188. @set noindent_macro @noindent
  189. @set refill_macro @refill
  190. @@page @value{page_macro} @@noindent @value{noindent_macro} @@refill @value{refill_macro} something
  191. @value{noindent_macro} noindent at beginning of line
  192. @value{noindent_macro}
  193. noindent on the preceding line
  194. @value{noindent_macro} noindent after space at beginning of line
  195. @page page at beginning of line
  196. @page
  197. After page on it\'s own line.
  198. @@page @value{page_macro} @@noindent @value{noindent_macro} @@refill @value{refill_macro}
  199. @set contents_macro @contents
  200. @value{contents_macro}
  201. @vskip @value{text}
  202. @set cropmarks_command @cropmarks
  203. @value{cropmarks_command}
  204. @set exdent_macro @exdent
  205. @value{exdent_macro} line after exdent
  206. @set two 2
  207. @sp @value{two}
  208. @set result_macro @result
  209. @clickstyle @value{result_macro}
  210. @value{contents_macro}
  211. @set shortcontents_macro @shortcontents
  212. @value{shortcontents_macro}
  213. @set bye_macro @bye
  214. @value{bye_macro}',
  215. {'expanded_formats' => []}
  216. ],
  217. ['value_in_invalid_documentencoding',
  218. '@set badvalue bad
  219. @documentencoding @value{badvalue}
  220. '],
  221. ['set_flag_command_equivalent',
  222. '@set txicodequoteundirected
  223. @value{txicodequoteundirected}.
  224. @clear txicodequoteundirected
  225. '],
  226. ['set_on_item_line',
  227. '@table @code
  228. @item @set a b@c
  229. item text
  230. in item
  231. @item jj @set j@c
  232. line
  233. @item vvv @set g@c
  234. @end table
  235. @table @code
  236. @item @set a b
  237. item text
  238. in item
  239. @item jj @set j
  240. line
  241. @item vvv @set g
  242. @end table
  243. '],
  244. ['set_in_item_missing_line',
  245. '@table @code
  246. @item xx @set n
  247. @item jj
  248. @end table
  249. @table @code
  250. @item xx @set n@c
  251. @item jj
  252. @end table
  253. '],
  254. ['set_form_feed',
  255. '@set gg a\\a\\f\\\\
  256. @set hh
  257. @set ll
  258. @code{@value{gg}. @value{hh}. @value{ll}}.
  259. ', {'test_formats' => ['xml']}
  260. ],
  261. ['ignored_value_definition',
  262. '@set aa outside
  263. @inlinefmt{tex,
  264. @set aa in inlinefmt tex
  265. }
  266. @value{aa}.
  267. ']
  268. );
  269. our ($arg_test_case, $arg_generate, $arg_debug);
  270. run_all ('value', \@test_cases, $arg_test_case,
  271. $arg_generate, $arg_debug);