languages.t 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. '@documentlanguage fr
  8. @node Top
  9. @defivar AAA BBB CCC
  10. @end defivar
  11. '],
  12. ['multiple',
  13. '@documentlanguage fr
  14. @copying
  15. @defivar copying a b
  16. @end defivar
  17. @end copying
  18. @node Top
  19. @defivar fr BBB CCC
  20. @end defivar
  21. @insertcopying
  22. @documentlanguage pt
  23. @defivar pt BBB CCC
  24. @end defivar
  25. @insertcopying
  26. '],
  27. ['appendix_translated',
  28. '@documentlanguage fr
  29. @node Top
  30. @top top
  31. @appendix dernier
  32. @contents
  33. '
  34. ],
  35. ['command_translated',
  36. '@documentlanguage fr
  37. @node Top
  38. @top top @error{}
  39. @error{}
  40. '],
  41. ['unknown_language',
  42. '@documentlanguage unknown
  43. @node Top
  44. @top unknkown language
  45. Unknown language. @xref{Top}.
  46. @documentlanguage another_UNKNOWN
  47. Another unknown language. @xref{Top}.
  48. '],
  49. ['unknown_region',
  50. '@documentlanguage fr_NOWHERE
  51. @node Top
  52. @defivar AAA BBB CCC
  53. @end defivar
  54. '],
  55. );
  56. my $multiple_lang_chapters_text =
  57. '@setfilename multiple_lang_chapters.info
  58. @documentencoding utf-8
  59. @node Top
  60. @top Multi language file
  61. @menu
  62. * chapter ja::
  63. * chapter en::
  64. * chapter fr_FR::
  65. * chapter de::
  66. * chapter pt_BR::
  67. @end menu
  68. @documentlanguage ja
  69. @node chapter ja
  70. @chapter ja
  71. In japanese. @xref{Top}.
  72. @defivar AAA BBB CCC
  73. @end defivar
  74. @documentlanguage en
  75. @node chapter en
  76. @chapter en
  77. In english. @xref{Top}.
  78. @defivar AAA BBB CCC
  79. @end defivar
  80. @documentlanguage fr_FR
  81. @node chapter fr_FR
  82. @chapter fr_FR
  83. @defivar AAA BBB CCC
  84. @end defivar
  85. @documentlanguage de
  86. @node chapter de
  87. @chapter de
  88. @documentlanguage pt_BR
  89. @node chapter pt_BR
  90. @chapter pt_bR
  91. In brazilian. @xref{Top}.
  92. ';
  93. my @file_tests = (
  94. ['multiple_lang_chapters',
  95. $multiple_lang_chapters_text, {}, {'SPLIT' => 0}],
  96. ['multiple_lang_chapters_texi2html',
  97. $multiple_lang_chapters_text,
  98. {'test_input_file_name' => 'multiple_lang_chapters.texi'},
  99. {'SPLIT' => 0, 'TEXI2HTML' => 1, 'TEST' => 1}],
  100. );
  101. my %info_tests = (
  102. 'multiple' => 1,
  103. 'appendix_translated' => 1,
  104. 'command_translated' => 1,
  105. 'unknown_language' => 1,
  106. 'unknown_region' => 1,
  107. );
  108. foreach my $test (@test_cases) {
  109. push @{$test->[2]->{'test_formats'}}, 'plaintext';
  110. if ($info_tests{$test->[0]}) {
  111. push @{$test->[2]->{'test_formats'}}, 'info';
  112. push @{$test->[2]->{'test_formats'}}, 'html';
  113. }
  114. }
  115. foreach my $test (@file_tests) {
  116. push @{$test->[2]->{'test_formats'}}, 'file_html';
  117. push @{$test->[2]->{'test_formats'}}, 'file_info';
  118. }
  119. our ($arg_test_case, $arg_generate, $arg_debug);
  120. run_all ('languages', [@test_cases, @file_tests], $arg_test_case,
  121. $arg_generate, $arg_debug);
  122. 1;