diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-08-19 14:48:47 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-08-19 14:48:47 +0200 |
commit | 13f51c2044fb22f6b3cb8c674a23fe636f7fb33d (patch) | |
tree | dc7d9cc7aabff00fd59f1a255faf4c1ce581e65b /t/timespec_to_seconds.t | |
parent | dcb88a73de56ed32368ebbf9b22053b2c1b1c89b (diff) | |
download | App-BorgRestore-13f51c2044fb22f6b3cb8c674a23fe636f7fb33d.tar.gz App-BorgRestore-13f51c2044fb22f6b3cb8c674a23fe636f7fb33d.tar.xz |
Reorganize tests
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 't/timespec_to_seconds.t')
-rw-r--r-- | t/timespec_to_seconds.t | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/timespec_to_seconds.t b/t/timespec_to_seconds.t new file mode 100644 index 0000000..0f367c9 --- /dev/null +++ b/t/timespec_to_seconds.t @@ -0,0 +1,21 @@ +use strict; +use warnings; + +use Test::More; + +use App::BorgRestore; + +my $app = App::BorgRestore->new_no_defaults(undef); + +is($app->_timespec_to_seconds('5s'), 5, '5 seconds'); +is($app->_timespec_to_seconds('5minutes'), 5*60, '5 minutes'); +is($app->_timespec_to_seconds('6d'), 6*60*60*24, '6 days'); +is($app->_timespec_to_seconds('8m'), 8*60*60*24*31, '8 months'); +is($app->_timespec_to_seconds('2y'), 2*60*60*24*365, '2 years'); + +is($app->_timespec_to_seconds('5sec'), undef, 'invalid unit returns undef'); +is($app->_timespec_to_seconds('5'), undef, 'missing unit returns undef'); +is($app->_timespec_to_seconds('blub'), undef, 'string returns undef'); +is($app->_timespec_to_seconds(''), undef, 'empty string returns undef'); + +done_testing; |