05paragraph.t 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # $Id$
  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. [ 'text', 'text' ],
  8. [ 'text_comment', 'text@c comment' ],
  9. [ 'text_space_comment', ' text @c space comment' ],
  10. [ 'text_line', '
  11. text
  12. '],
  13. [ 'comment_between_text', 'text
  14. @c comment
  15. end para' ],
  16. [ 'two_lines','text l 1
  17. text l 2
  18. '],
  19. [ 'no_paragraph_commands', '@*
  20. @titlefont{title font}
  21. @image{aa,bb,cc,dd,ee}
  22. '],
  23. [ 'paragraph_command','@@
  24. @b{aaa}.
  25. @dotless{i} also dotless i.
  26. @U{0075} also U+0075.
  27. @email{m1} email.
  28. @definfoenclose foo,\\,//
  29. @foo{@@definfoenclose} should work at the beginning of a new paragraph.
  30. @footnote{lone footnote}.
  31. '],
  32. ['image_in_paragraph',
  33. 'Para. @image{aa,bb,cc,dd,ee}. After image.
  34. '],
  35. ['close_paragraph_command',
  36. 'para @titlefont{in titlefont} after titlefont.
  37. p before sp
  38. @sp 4
  39. inew p after sp'
  40. ],
  41. ['paragraph_indent_asis',
  42. '@paragraphindent asis
  43. para
  44. fff
  45. @quotation
  46. in quotation
  47. @end quotation
  48. '],
  49. ['paragraph_count_and_example',
  50. '@example
  51. in example
  52. @end example
  53. After.
  54. '],
  55. ['comment_in_quotation',
  56. '
  57. @quotation
  58. Quotation @c
  59. @end quotation
  60. @quotation
  61. Quotation no space@c
  62. @end quotation
  63. '],
  64. ['commands_in_flushright',
  65. '@flushright
  66. @group
  67. in group
  68. @end group
  69. @quotation type
  70. in quotation
  71. @end quotation
  72. @enumerate
  73. @item item
  74. @item other item
  75. @end enumerate
  76. @table @emph
  77. @item table item
  78. @itemx table itemx
  79. Table text
  80. Text.
  81. @end table
  82. @multitable @columnfractions 0.5 0.5
  83. @item col1 @tab col2
  84. @item text
  85. in multitable
  86. @tab
  87. text col2
  88. @end multitable
  89. @float label, type
  90. in float
  91. @caption{in caption}
  92. @end float
  93. Sp:
  94. @sp 2
  95. @smallexample
  96. in example
  97. @end smallexample
  98. @format
  99. in format
  100. @end format
  101. @flushleft
  102. in flushleft
  103. @end flushleft
  104. @center in center
  105. @end flushright
  106. '],
  107. );
  108. my @test_invalid = (
  109. ['paragraph_in_style_command',
  110. 'a 2 paragraphs sample @samp{in first paragraph
  111. in second}.
  112. a 3 paragraphs sample @samp{in first paragraph
  113. in second
  114. in third}.
  115. '],
  116. ['double_style_paragraph',
  117. '@emph{@strong{
  118. First para.
  119. Second para.
  120. }
  121. }
  122. '],
  123. );
  124. foreach my $test (@test_cases) {
  125. push @{$test->[2]->{'test_formats'}}, 'plaintext';
  126. push @{$test->[2]->{'test_formats'}}, 'html_text';
  127. }
  128. our ($arg_test_case, $arg_generate, $arg_debug);
  129. run_all ('paragraph', [@test_cases, @test_invalid], $arg_test_case,
  130. $arg_generate, $arg_debug);