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/helper | |
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/helper')
-rw-r--r-- | t/helper/untaint.t | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/helper/untaint.t b/t/helper/untaint.t new file mode 100644 index 0000000..f9d8a9c --- /dev/null +++ b/t/helper/untaint.t @@ -0,0 +1,19 @@ +use strict; +use warnings; + +use Test::More; +use Test::Exception; + +use App::BorgRestore::Helper; + +ok(App::BorgRestore::Helper::untaint_archive_name('abc-1234:5+1') eq 'abc-1234:5+1'); +ok(App::BorgRestore::Helper::untaint_archive_name('abc') eq 'abc'); +ok(App::BorgRestore::Helper::untaint_archive_name('root-2016-09-30T15+02:00.checkpoint') eq 'root-2016-09-30T15+02:00.checkpoint'); + +dies_ok(sub{App::BorgRestore::Helper::untaint_archive_name('abc`"\'')}, 'special chars not allowed'); +dies_ok(sub{App::BorgRestore::Helper::untaint_archive_name('abc`')}, 'special chars not allowed'); +dies_ok(sub{App::BorgRestore::Helper::untaint_archive_name('abc"')}, 'special chars not allowed'); +dies_ok(sub{App::BorgRestore::Helper::untaint_archive_name('abc\'')}, 'special chars not allowed'); + + +done_testing; |