reference_to_text_in_tree.t 825 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 => 2; }
  8. use Texinfo::Parser qw(parse_texi_text);
  9. use Texinfo::Transformations;
  10. use Texinfo::Convert::Texinfo;
  11. ok(1);
  12. sub run_test($$$)
  13. {
  14. my $in = shift;
  15. my $out = shift;
  16. my $name = shift;
  17. my $parser = Texinfo::Parser::parser();
  18. my $tree = parse_texi_text($parser, $in);
  19. my $corrected_tree
  20. = Texinfo::Transformations::reference_to_arg_in_tree($parser, $tree);
  21. my $texi_result = Texinfo::Convert::Texinfo::convert($corrected_tree);
  22. if (!defined($out)) {
  23. print STDERR " --> $name:\n$texi_result";
  24. } else {
  25. is ($texi_result, $out, $name);
  26. }
  27. }
  28. run_test('AA @ref{a, b, c, d, e} (@pxref{,,, @code{trc}})',
  29. 'AA a (@code{trc})', 'simple test');