Text::Markdown::Discount
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
770 B

16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
16 years ago
  1. #/usr/bin/perl
  2. use ExtUtils::testlib;
  3. use Text::Markdown 'markdown';
  4. use Text::Markdown::PegMarkdown;
  5. use Benchmark;
  6. use File::Slurp;
  7. use Text::Diff;
  8. my $text = read_file('xt/index.text');
  9. my $a = Text::Markdown::PegMarkdown::markdown($text);
  10. my $b = Text::Markdown::markdown($text);
  11. $a =~ s{'}{'\\''}g; # escape ' chars for shell
  12. $b =~ s{'}{'\\''}g;
  13. $a = `echo '$a' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
  14. $b = `echo '$b' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
  15. unless ( $a eq $b ) {
  16. print diff \$a, \$b;
  17. #die "BOO";
  18. }
  19. my $count = 1000;
  20. timethese($count, {
  21. 'B_Text::Markdown::PegMarkdown' => sub { Text::Markdown::PegMarkdown::markdown($text) },
  22. 'A_Text::Markdown' => sub { Text::Markdown::markdown($text) },
  23. });