Fix a bug in delHTMLcom where comments were left open
Change-Id: I424ac394fa7eaad9a2b62c61761d2de6720870a2
diff --git a/xt/benchmark.pl b/xt/benchmark.pl
index 35c0c65..ddd17a2 100644
--- a/xt/benchmark.pl
+++ b/xt/benchmark.pl
@@ -4,7 +4,7 @@
use Dumbbench;
use File::Basename 'dirname';
use File::Spec::Functions qw/catfile rel2abs/;
-use File::Temp ':POSIX';
+use File::Temp 'tempfile';
use FindBin;
use Getopt::Long;
@@ -41,6 +41,15 @@
);
my $result;
+my ($fh, $filename) = tempfile();
+
+print $fh <<'HTML';
+mehrzeiliger
+Kommentar
+ --><!-- Versuch
+-->ist <!-- a --><!-- b --> ein Test
+HTML
+
# Add benchmark instances
$bench->add_instances(
@@ -61,11 +70,26 @@
};
}
),
+ Dumbbench::Instance::PerlSub->new(
+ name => 'delHTMLcom-long',
+ code => sub {
+ for (1..10_000) {
+ $result = KorAP::XML::TEI::delHTMLcom(
+ $fh,
+ "This <!--" . $_
+ );
+ seek($fh, 0, 0);
+ };
+ }
+ ),
);
# Run benchmarks
$bench->run;
+# Clean up
+close($fh);
+
# Output in a single row
if ($columns) {
unless ($no_header) {