summaryrefslogtreecommitdiffstats
path: root/t/02_parsing.t
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-08-19 14:48:47 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-08-19 14:48:47 +0200
commit13f51c2044fb22f6b3cb8c674a23fe636f7fb33d (patch)
treedc7d9cc7aabff00fd59f1a255faf4c1ce581e65b /t/02_parsing.t
parentdcb88a73de56ed32368ebbf9b22053b2c1b1c89b (diff)
downloadApp-BorgRestore-13f51c2044fb22f6b3cb8c674a23fe636f7fb33d.tar.gz
App-BorgRestore-13f51c2044fb22f6b3cb8c674a23fe636f7fb33d.tar.xz
Reorganize tests
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 't/02_parsing.t')
-rw-r--r--t/02_parsing.t53
1 files changed, 0 insertions, 53 deletions
diff --git a/t/02_parsing.t b/t/02_parsing.t
deleted file mode 100644
index c2b8e78..0000000
--- a/t/02_parsing.t
+++ /dev/null
@@ -1,53 +0,0 @@
-use strict;
-use warnings;
-
-use POSIX qw(tzset);
-use Test::Differences;
-use Test::MockObject;
-use Test::More;
-
-use App::BorgRestore;
-
-# Only log calls to $db->add_path
-my $db = Test::MockObject->new();
-$db->set_true(qw(add_path -begin_work -commit -vacuum -add_archive_name -verify_cache_fill_rate_ok));
-$db->mock('-get_archive_id', sub {return 'prefix-archive-1' if $_[1] eq 'archive-1';});
-$db->mock('-get_archive_names', sub {return []});
-
-$ENV{TZ} = 'UTC';
-tzset;
-
-my $borg = Test::MockObject->new();
-$borg->set_list('borg_list', ['archive-1']);
-$borg->mock('list_archive', sub {
- my ($self, $archive, $cb) = @_;
- $cb->("XXX, 1970-01-01 00:00:05 .");
- $cb->("XXX, 1970-01-01 00:00:10 boot");
- $cb->("XXX, 1970-01-01 00:00:20 boot/grub");
- $cb->("XXX, 1970-01-01 00:00:08 boot/grub/grub.cfg");
- $cb->("XXX, 1970-01-01 00:00:13 boot/foo");
- $cb->("XXX, 1970-01-01 00:00:13 boot/foo/blub");
- $cb->("XXX, 1970-01-01 00:00:19 boot/foo/bar");
- } );
-
-# Call the actual function we want to test
-my $app = App::BorgRestore->new({borg => $borg, db => $db});
-$app->_handle_added_archives(['archive-1']);
-
-# Check if $db->add_path has been called properly
-my (@calls, @a);
-push @calls, [@a] while @a = $db->next_call();
-
-# sort by path
-@calls = sort {$a->[1][2] cmp $b->[1][2];} @calls;
-
-eq_or_diff(\@calls, [
- ['add_path', [$db, 'prefix-archive-1', 'boot', 20]],
- ['add_path', [$db, 'prefix-archive-1', 'boot/foo', 19]],
- ['add_path', [$db, 'prefix-archive-1', 'boot/foo/bar', 19]],
- ['add_path', [$db, 'prefix-archive-1', 'boot/foo/blub', 13]],
- ['add_path', [$db, 'prefix-archive-1', 'boot/grub', 20]],
- ['add_path', [$db, 'prefix-archive-1', 'boot/grub/grub.cfg', 8]],
- ], "Database is populated with the correct timestamps");
-
-done_testing;