Dear Monks
PDF::PDFUnit let's us verify PDF documents using perl. It seems to do a good job, except for the notContaining function. It seems to always return true (here a rewritten version of 01-load.t). The basic idea is to detect presence of unwanted words, such as the name of the former CEO:
$ cat t/01-test-mod.t
use strict;
use utf8;
use warnings;
use FindBin;
use File::Spec;
use Test::More;
use Test::Exception;
use PDF::PDFUnit qw(:skip_on_error);
my $resources_dir = File::Spec->catfile($FindBin::Bin, 'resources');
my $pdfReference = "$resources_dir/reference.pdf";
lives_ok {
AssertThat
->document($pdfReference)
->hasText()
->containing("Hello")
} "containing Hello";
lives_ok {
AssertThat
->document($pdfReference)
->hasText()
->notContaining("Hello")
} "notContaining Hello";
diag $@->getMessage() if $@;
done_testing();
__END__
$ perl t/01-test-mod.t
ok 1 - containing Hello
ok 2 - notContaining Hello
1..2
$
Do anyone have experience with this module?
openjdk-8-jre:amd64 + Ubuntu 16.04.1 LTS + perl v5.22.1
BR
Andreas
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|