Simplify runtime imports in test code
Also use `BAIL_OUT` instead of `die` if `require 'ddclient'` fails.
This commit is contained in:
parent
858fe53072
commit
0cc83cd5ec
2 changed files with 5 additions and 3 deletions
|
@ -61,7 +61,9 @@ To add a new test script:
|
||||||
|
|
||||||
```perl
|
```perl
|
||||||
use Test::More;
|
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.
|
# Your tests go here.
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ To add a new test script:
|
||||||
module is not available. For example:
|
module is not available. For example:
|
||||||
|
|
||||||
```perl
|
```perl
|
||||||
eval { require Foo::Bar; Foo::Bar->import(); 1 } or plan(skip_all => $@);
|
eval { require Foo::Bar; } or plan(skip_all => $@);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use version;
|
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");
|
is(ddclient->VERSION(), version->parse('v@PACKAGE_VERSION@'), "version matches Autoconf config");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue