20preformatted.t 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. ['empty_line',
  7. '@example
  8. example
  9. after empty line
  10. @end example
  11. '],
  12. ['quote_dash_in_example',
  13. '
  14. @example
  15. and now -- yes---now and ``so\'\'.
  16. @end example
  17. '],
  18. ['quote_dash_in_display',
  19. '
  20. @display
  21. and now -- yes---now and ``so\'\'.
  22. @end display
  23. '],
  24. ['text_on_command_line',
  25. '@example text on line
  26. @end example
  27. @example text on line followed by text
  28. normal text
  29. @end example
  30. @example
  31. in example
  32. @end example text after end
  33. @example
  34. @example
  35. @end example text after end example nested in example
  36. @end example
  37. '],
  38. ['def_in_example',
  39. '@example
  40. @defun name arg
  41. in defun
  42. @end defun
  43. @end example
  44. '],
  45. ['caption_in_example',
  46. '@float float
  47. @example
  48. in example
  49. @caption{caption}
  50. After caption
  51. @end example
  52. @end float
  53. '],
  54. ['titlefont_in_example',
  55. '@example
  56. @titlefont{Title}
  57. Text.
  58. @end example
  59. '],
  60. ['comments_in_example',
  61. 'Example with comments 2 lines
  62. @example
  63. line @c comment
  64. second line @c comment
  65. @end example
  66. Example with comments 1 line
  67. @example
  68. line @c comment
  69. @end example
  70. Example with newline after comment
  71. @example
  72. line @c comment
  73. second line
  74. @end example
  75. '],
  76. ['nested_example_and_comment',
  77. '@example
  78. First line 0 @c
  79. @example
  80. Nested example
  81. @end example
  82. In first one
  83. @end example
  84. @example
  85. First line 1 @c
  86. @example
  87. Nested example @c
  88. @end example
  89. In first one
  90. @end example
  91. @example
  92. First line 2 @c
  93. @example
  94. Nested example @c
  95. @end example
  96. In first one @c
  97. @end example
  98. '],
  99. ['nested_formats',
  100. '@format
  101. @example
  102. in -- format/example
  103. @end example
  104. @end format
  105. @example
  106. @format
  107. in -- example/format
  108. @end format
  109. @end example
  110. '],
  111. ['comment_example_and_blank_lines',
  112. 'Para.
  113. @example
  114. comment, blank after @c comment
  115. @end example
  116. Para.
  117. @example
  118. comment, no blank after @c comment
  119. @end example
  120. Para.
  121. @example
  122. no comment, blank after
  123. @end example
  124. Para.
  125. @example
  126. no comment, no blank after
  127. @end example
  128. Para.
  129. '],
  130. ['page_in_example',
  131. '@example
  132. @page
  133. text
  134. @end example
  135. '],
  136. ['insertcopying_in_example',
  137. '@example
  138. @insertcopying
  139. text
  140. @end example
  141. '],
  142. );
  143. my @test_invalid = (
  144. ['empty_line_style_command',
  145. '@example
  146. example @samp{in samp
  147. after empty} line
  148. @end example
  149. '],
  150. );
  151. foreach my $test (@test_cases) {
  152. push @{$test->[2]->{'test_formats'}}, 'plaintext';
  153. push @{$test->[2]->{'test_formats'}}, 'html_text';
  154. push @{$test->[2]->{'test_formats'}}, 'docbook';
  155. push @{$test->[2]->{'test_formats'}}, 'xml';
  156. }
  157. our ($arg_test_case, $arg_generate, $arg_debug);
  158. run_all ('preformatted', [@test_cases, @test_invalid], $arg_test_case,
  159. $arg_generate, $arg_debug);