06columnfractions.t 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. use Test::More;
  2. use strict;
  3. use File::Spec;
  4. BEGIN { if (defined($ENV{'top_srcdir'})) {unshift @INC, File::Spec->catdir($ENV{'top_srcdir'}, 'tp');} }
  5. require 't/test_utils.pl';
  6. my @test_cases = (
  7. [ 'good', '@multitable @columnfractions 0.4 .6 5.
  8. @end multitable' ],
  9. [ 'good_comment', '@multitable @columnfractions 0.4 .6 5.@c comment
  10. @end multitable' ],
  11. [ 'good_space_comment', '@multitable @columnfractions 0 1 @c space comment
  12. @end multitable' ],
  13. [ 'not_fraction','@multitable @columnfractions aaa
  14. @end multitable' ],
  15. [ 'empty', '@multitable @columnfractions
  16. @end multitable' ],
  17. [ 'empty_comment', '@multitable @columnfractions @c
  18. @end multitable' ],
  19. [ 'wrong_command', '@multitable @columnfractions @b{3.4}
  20. @end multitable' ],
  21. [ 'out_of_multitable', '@columnfractions 0.6 0.4 aaa' ],
  22. [ 'something_before_columnfractions', '@multitable aaa @columnfractions 0.3 0.7
  23. @end multitable' ]
  24. );
  25. our $arg_generate;
  26. our $arg_complete;
  27. our $arg_test_case;
  28. our $arg_debug;
  29. our $nr_comparisons;
  30. ok(1);
  31. my $test = new_test('columnfractions', $arg_generate, $arg_debug);
  32. my @done_tests;
  33. foreach my $test_case (@test_cases) {
  34. next if ($arg_test_case and $arg_test_case ne $test_case->[0]);
  35. if ($arg_complete) {
  36. $test->output_texi_file($test_case);
  37. } else {
  38. $test->test($test_case);
  39. push @done_tests, $test_case;
  40. }
  41. }
  42. if ($arg_generate or $arg_complete) {
  43. plan tests => 2;
  44. }
  45. else {
  46. plan tests => (2 + scalar(@done_tests) * $nr_comparisons);
  47. }