Browse Source

* diag diff if it failed

Masayoshi Sekimura 10 years ago
parent
commit
0e43c3138f
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      xt/MarkdownTest_1.0.3.t

+ 9
- 4
xt/MarkdownTest_1.0.3.t View File

@@ -13,21 +13,26 @@ BEGIN { use_ok('Text::Markdown::Discount') };
13 13
 #########################
14 14
 
15 15
 use FindBin qw($Bin);
16
+use Text::Diff;
16 17
 
17 18
 opendir(DIR, "$Bin/../xt/MarkdownTest_1.0.3/Tests");
18 19
 
19 20
 foreach my $testfile (grep { /\.text$/ } readdir(DIR)) {
20 21
     my $testname = $testfile;
21 22
     $testname =~ s{(.+)\.text$}{$1}i; 
22
-    ok $testfile, $testname;
23
-    open (EXPECTED, "$Bin/../xt/MarkdownTest_1.0.3/Tests/$testname" . '.html');
23
+    open (EXPECTED, "$Bin/../xt/MarkdownTest_1.0.3/Tests/$testname" . '.html') or die "NO html file for $testname";
24 24
     my $expected = do {undef $/; <EXPECTED>};
25
-    my $actual = `$Bin/../xt/MarkdownXS.pl '$Bin/../xt/MarkdownTest_1.0.3/Tests/$testfile'`; 
25
+    my $actual = `$Bin/../xt/MarkdownXS.pl '$Bin/../xt/MarkdownTest_1.0.3/Tests/$testfile'` or die "failed run MarkdownXS.pl $testfile"; 
26 26
 
27 27
     $expected =~ s{'}{'\\''}g; # escape ' chars for shell
28 28
     $actual =~ s{'}{'\\''}g;
29 29
     $expected = `echo '$expected' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
30 30
     $actual   = `echo '$actual' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
31 31
 
32
-    is ($actual, $expected, $testname);
32
+    if ($actual eq $expected) {
33
+        pass($testname);
34
+    } else {
35
+        fail($testname);
36
+        diag diff \$expected, \$actual;
37
+    }
33 38
 }

Loading…
Cancel
Save