Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a test for svg-for-file()
  • Loading branch information
Paul Cochrane committed May 4, 2015
1 parent f5c65a2 commit 15dc4a1
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion t/pod-htmlify.t
@@ -1,6 +1,7 @@
use v6;
use Test;
use lib 'lib';
use File::Temp;

BEGIN {
unless (try require URI::Escape) {
Expand All @@ -10,7 +11,7 @@ BEGIN {
}
}

plan 3;
plan 4;

use-ok('Pod::Htmlify');
use Pod::Htmlify;
Expand All @@ -35,4 +36,32 @@ subtest {
isnt(footer-html("/home/camelia/this_text.pod"), "", "footer text isn't empty");
}, "footer-html";

subtest {
plan 1;

my $test-svg = q:to/EOF/;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
-->
<!-- Title: perl6&#45;type&#45;graph Pages: 1 -->
<svg width="66pt" height="188pt"
viewBox="0.00 0.00 66.49 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
</svg>
EOF

my ($filename, $filehandle) = tempfile;
$filehandle.IO.spurt($test-svg);
$filehandle.flush;

my $expected-svg = q:to/EOF/;
<svg width="66pt" height="188pt"
viewBox="0.00 0.00 66.49 188.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
</svg>
EOF
my $svg = svg-for-file($filename);
is($svg, $expected-svg.chomp, "SVG content extracted correctly");
}, "svg-for-file";

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit 15dc4a1

Please sign in to comment.