diff --git a/cap2site.pl b/cap2site.pl index 6598449..329126d 100755 --- a/cap2site.pl +++ b/cap2site.pl @@ -199,10 +199,12 @@ sub parse($$$) { print '
', escape(trimLeft(substr $line, 1)), '', "\n"; } + elsif ($line eq "") { + print '
';
- print (length($line) == 0 ? '
' : escape $line);
- print '
', escape($line), '
', "\n"; } } diff --git a/t/hello_exp.html b/t/hello_exp.html new file mode 100644 index 0000000..f24c61f --- /dev/null +++ b/t/hello_exp.html @@ -0,0 +1,2 @@ +Lorem ipsum dolor sit amet
diff --git a/t/hello_standalone_exp.html b/t/hello_standalone_exp.html new file mode 100644 index 0000000..eb71546 --- /dev/null +++ b/t/hello_standalone_exp.html @@ -0,0 +1,11 @@ + + + + + + + +Lorem ipsum dolor sit amet
+ + diff --git a/t/script.pl b/t/script.pl index c2b42fd..1685c32 100755 --- a/t/script.pl +++ b/t/script.pl @@ -7,27 +7,17 @@ sub test($$$) { my ($cmd,$file,$expected) = @_; my $res = readpipe($cmd . " < t/" . $file); - $res eq $expected or die "FAIL: $cmd\nEXPECTED:\n$expected\nACTUAL:\n$res"; + my $exp = do { + local $/ = undef; + open my $fh, "<", "t/" . $expected + or die "error opening file: $!"; + <$fh> + }; + + $res eq $exp or die "FAIL: $cmd\nEXPECTED:\n$exp\nACTUAL:\n$res"; } -# TODO: testing format -test("./cap2site.pod", "hello.gmi", <<'EOF'); -Lorem ipsum dolor sit amet
-EOF - -test("./cap2site.pod -s", "hello.gmi", <<'EOF'); - - - - - - - -Lorem ipsum dolor sit amet
- - -EOF +test("./cap2site.pod", "hello.gmi", "hello_exp.html"); +test("./cap2site.pod -s", "hello.gmi", "hello_standalone_exp.html"); say "DONE!";