diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-09-29 22:59:46 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-09-29 22:59:46 -0700 |
commit | d9f7581443bd786e7d17532f6678efd2ee77c26f (patch) | |
tree | 831a33dc8990e3b85ea068b361750702f8e3f40a /runtests.pl | |
parent | de1e28217f0da80b928bca0ca09541c0401314ee (diff) | |
parent | c006aececef112f61dd44cad43f0596221f29700 (diff) |
Merge branch 'master' into newemphasis
Conflicts:
Makefile
js/stmd.js
Diffstat (limited to 'runtests.pl')
-rw-r--r-- | runtests.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/runtests.pl b/runtests.pl index 2e2b795..0bff360 100644 --- a/runtests.pl +++ b/runtests.pl @@ -38,7 +38,9 @@ sub tidy } elsif (/<\/pre/) { $inpre = 0; } - if ($inpre) { + # remove \r to allow mixing linux/windows newlines + s/\r//; + if ($inpre) { print $outfh $_; } else { # remove leading spaces @@ -49,6 +51,7 @@ sub tidy s/ */ /; # collapse space before /> in tag s/ *\/>/\/>/; + s/>\n$/>/; # skip blank line if (/^$/) { next; @@ -69,15 +72,17 @@ sub dotest # We use → to indicate tab and ␣ space in the spec $markdown =~ s/→/\t/g;s/␣/ /g; $html =~ s/→/\t/g;s/␣/ /g; - open2(my $out, my $in, @PROG); + my $pid = open2(my $out, my $in, @PROG); print $in $markdown; close $in; flush $out; $actual = do { local $/; <$out>; }; close $out; + waitpid($pid, 0); $html = &tidy($html); $actual = &tidy($actual); $actual =~ s/\'/'/; + if ($actual eq $html) { print colored("✓", "green"); return 1; @@ -89,8 +94,10 @@ sub dotest print $markdown; print "=== expected ===============\n"; print $html; + print "\n"; print "=== got ====================\n"; print $actual; + print "\n"; print color "black"; return 0; } |