fix_texinfo.t 861 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. use strict;
  2. BEGIN {
  3. require Texinfo::ModulePath;
  4. Texinfo::ModulePath::init(undef, undef, 'updirs' => 2);
  5. }
  6. use Test::More;
  7. BEGIN { plan tests => 4; }
  8. use Texinfo::Parser;
  9. use Texinfo::Convert::Texinfo;
  10. sub run_test($$$)
  11. {
  12. my $in = shift;
  13. my $out = shift;
  14. my $name = shift;
  15. my $tree = Texinfo::Parser::parse_texi_text (undef, $in);
  16. my $result = Texinfo::Convert::Texinfo::convert($tree, 1);
  17. if (defined($out)) {
  18. is ($result, $out, $name);
  19. } else {
  20. print "$name:\n";
  21. print STDERR $result;
  22. }
  23. }
  24. run_test ('@deffn a b c d ', '@deffn a b c d @end deffn'."\n",
  25. 'deffn line not closed');
  26. run_test ('A@code{
  27. @table @asis
  28. @item it
  29. @end table
  30. }', 'A@code{
  31. }', 'table in code');
  32. run_test ('@anchor{@ref{Somewhere}}', '@anchor{}', 'ref in anchor');
  33. run_test ('@page on page line
  34. ',
  35. '@page
  36. ', 'garbage on page line');