80include.t 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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',
  7. '@include inc_file.texi
  8. '],
  9. ['simple_no_eol',
  10. '@include inc_file.texi'
  11. ],
  12. ['no_eol_in_included_file',
  13. 'Some thing.
  14. @include include_noeol.texi
  15. Following
  16. '],
  17. ['macro_definition_in_include',
  18. '@include macro_included.texi
  19. Call macro
  20. @themacro{}
  21. '],
  22. ['value_expansion_in_include',
  23. '@set testvar incl-incl.txi
  24. @c test - in the variable name, and concatenation of text after.
  25. @set test-var incl-incl.tx
  26. @c test - in the variable name, and concatenation of text before and after.
  27. @set test_var ncl-incl.tx
  28. @node Top
  29. testvar include: @include @value{testvar}
  30. testvar verbatiminclude: @verbatiminclude @value{testvar}
  31. test-var include: @include @value{test-var}i
  32. test-var verbatiminclude: @verbatiminclude @value{test-var}i
  33. test_var include: @include i@value{test_var}i
  34. test_var verbatiminclude: @verbatiminclude i@value{test_var}i
  35. '],
  36. ['macro_in_early_commands',
  37. '@macro begin-file
  38. macro_in_pass
  39. @end macro
  40. @macro end-file-name {ext}
  41. texi_commands.\ext\
  42. @end macro
  43. @setfilename @begin-file{}@end-file-name{info}
  44. @macro latin1
  45. ISO-8859-1
  46. @end macro
  47. @macro documentencoding-command
  48. @documentencoding
  49. @end macro
  50. @documentencoding-command @latin1{}
  51. @macro multiinclude
  52. macro_included.texi
  53. @include inc_file.texi
  54. @end macro
  55. @node Top
  56. @top top
  57. @include @multiinclude
  58. @themacro{}
  59. macro_in_pass_texi_commands@{info@}
  60. @end-file-name{info}
  61. '],
  62. # the difference with the previous is that there are @-commands, like @@
  63. ['macro_and_commands_in_early_commands',
  64. '@macro begin-file
  65. macro_i--n_pass@@
  66. @end macro
  67. @setfilename @begin-file{}texi_commands.info
  68. @macro latin1
  69. ISO-8859-1@@
  70. @end macro
  71. @documentencoding @latin1{}
  72. @macro multiinclude
  73. macro_included.texi
  74. @include inc_@@f--ile.texi
  75. @end macro
  76. @node Top
  77. @top top
  78. @include @multiinclude
  79. @themacro{}
  80. @verbatiminclude inc_@@f--ile.texi
  81. '],
  82. ['test_paths',
  83. '@include inc_file.texi
  84. @include ./t/include_dir/inc_file.texi
  85. @@include dot path.
  86. @include ./inc_file.texi
  87. '],
  88. ['test_include_directories',
  89. '
  90. @@include dot full path.
  91. @include ./t/include_dir/inc_file.texi
  92. @@include parent
  93. @include ../include_dir/inc_file.texi
  94. @@include dot full parent path
  95. @include ./tp/t/include_dir/inc_file.texi
  96. @c does not work in the standalone perl module
  97. @c @@include full parent path
  98. @c @include tp/t/include_dir/inc_file.texi
  99. ',{'include_directories' => ['.', '..', 't/include_dir']}],
  100. ['include_comment',
  101. '@include inc_file.texi@c comment'],
  102. ['include_space_comment',
  103. '@include inc_file.texi @c comment'],
  104. ['include_space',
  105. '@include inc_file.texi
  106. '],
  107. ['double_include',
  108. '
  109. @include inc_file.texi @include inc_file.texi
  110. '],
  111. ['include_at_end_line',
  112. '@include inc_file.texi@
  113. After.'],
  114. ['include_with_setfilename',
  115. # for now the plaintext expansion do not test anything as the setfilename in
  116. # included files is removed from the tree. But this may change in the future.
  117. '@include included_file_with_setfilename.texi
  118. @setfilename main_file.info
  119. ', {'test_formats' => ['info']}],
  120. ['include_setfilename_on_setfilename_line',
  121. '@setfilename file @setfilename other file @include are you joking!
  122. '],
  123. ['verbatiminclude_and_encoding',
  124. '@documentencoding utf-8
  125. @verbatiminclude verbatim_encoded.texi
  126. ', {'test_formats' => ['plaintext']}],
  127. ['verbatiminclude_and_encoding_latin1',
  128. '@documentencoding iso-8859-1
  129. @verbatiminclude verbatim_encoded_latin1.texi
  130. ', {'test_formats' => ['plaintext']}],
  131. ['cpp_lines',
  132. undef, {'test_file' => 'cpp_lines.texi'}
  133. ],
  134. );
  135. our ($arg_test_case, $arg_generate, $arg_debug);
  136. run_all ('include', \@test_cases, $arg_test_case,
  137. $arg_generate, $arg_debug);