70value_and_macro.t 996 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. ['macro_in_value',
  7. '@macro ab
  8. a
  9. b
  10. @end macro
  11. @set flagab @ab
  12. flagab: @value{flagab}
  13. '],
  14. ['comma_value_in_macro_arg',
  15. '@set comma ,
  16. @macro macro1 { arg1 , arg2 }
  17. result: @emph{\\arg1\\} protected \\\\ -> \\\\arg1\\\\ @emph{\\arg2\\}
  18. @end macro
  19. @macro1 { arg1 @value{comma} arg2 }
  20. '],
  21. ['value_in_macro_body',
  22. '@set bodyarg \\arg\\
  23. @macro testvaluebody { arg }
  24. result: @emph{\\@value{bodyarg}\\ }
  25. @end macro
  26. @testvaluebody{macro_arg1}
  27. '],
  28. ['value_in_macro_formal_arg',
  29. '@set argument arg
  30. @macro testvalue { arg , the@value{argument} }
  31. result: @emph{\\arg\\} the \\the\\ thearg \\thearg\\ with value \\the@value{argument}\\
  32. @end macro
  33. @testvalue{macro_arg1}
  34. ']
  35. );
  36. our ($arg_test_case, $arg_generate, $arg_debug);
  37. run_all ('value_and_macro', \@test_cases, $arg_test_case,
  38. $arg_generate, $arg_debug);