Simplify runtime imports in test code

Also use `BAIL_OUT` instead of `die` if `require 'ddclient'` fails.
This commit is contained in:
Richard Hansen 2020-06-29 16:43:45 -04:00
parent 858fe53072
commit 0cc83cd5ec
2 changed files with 5 additions and 3 deletions

View file

@ -61,7 +61,9 @@ To add a new test script:
```perl
use Test::More;
eval { require 'ddclient'; ddclient->import(); 1; } or die($@);
# Your test dependencies go here.
eval { require 'ddclient'; } or BAIL_OUT($@);
# Your tests go here.
@ -81,7 +83,7 @@ To add a new test script:
module is not available. For example:
```perl
eval { require Foo::Bar; Foo::Bar->import(); 1 } or plan(skip_all => $@);
eval { require Foo::Bar; } or plan(skip_all => $@);
```
## Compatibility

View file

@ -1,7 +1,7 @@
use Test::More;
use version;
eval { require 'ddclient'; ddclient->import(); 1; } or die($@);
eval { require 'ddclient'; } or BAIL_OUT($@);
is(ddclient->VERSION(), version->parse('v@PACKAGE_VERSION@'), "version matches Autoconf config");