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.

31 lines
1.1 KiB

  1. # Before `make install' is performed this script should be runnable with
  2. # `make test'. After `make install' it should work as `perl Text-Markdown-XS.t'
  3. #########################
  4. # change 'tests => 1' to 'tests => last_test_to_print';
  5. use Test::More qw(no_plan);
  6. BEGIN { use_ok('Text::Markdown::PegMarkdown') };
  7. #########################
  8. use FindBin qw($Bin);
  9. opendir(DIR, "$Bin/../xt/MarkdownTest_1.0.3/Tests");
  10. foreach my $testfile (grep { /\.text$/ } readdir(DIR)) {
  11. my $testname = $testfile;
  12. $testname =~ s{(.+)\.text$}{$1}i;
  13. ok $testfile, $testname;
  14. open (EXPECTED, "$Bin/../xt/MarkdownTest_1.0.3/Tests/$testname" . '.html');
  15. my $expected = do {undef $/; <EXPECTED>};
  16. my $actual = `$Bin/../xt/MarkdownXS.pl '$Bin/../xt/MarkdownTest_1.0.3/Tests/$testfile'`;
  17. $expected =~ s{'}{'\\''}g; # escape ' chars for shell
  18. $actual =~ s{'}{'\\''}g;
  19. $expected = `echo '$expected' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
  20. $actual = `echo '$actual' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
  21. is ($actual, $expected, $testname);
  22. }