#!/usr/bin/perl

use strict;
use Test::More tests => 2;

# copy files into place
mkdir("t/support/files/a")		unless -d "t/support/files/a";
`cp t/support/files/template/a/1 t/support/files/template/a/2 t/support/files/a/`;

# run rsnapshot once to copy the files into the snapshot root
`/usr/local/bin/perl ./rsnapshot -c t/support/etc/rsync.conf hourly`;

# now remove a file from the source
`rm -f t/support/files/a/1`;

# run rsnapshot again, it _should_ delete the "1" file
`/usr/local/bin/perl ./rsnapshot -c t/support/etc/relative_delete_bugfix.conf hourly`;

my $pwd = `pwd`;
chomp($pwd);
my $path_to_check = $pwd . '/t/support/snapshots/hourly.0/localhost/' . $pwd . '/t/support/files/a/';

# make sure the file was --deleted
ok( ! -e "$path_to_check/1" );

# make sure the other one is still there
ok(   -e "$path_to_check/2" );

`rm -f t/support/files/a/1 t/support/files/a/2`;


syntax highlighted by Code2HTML, v. 0.9.1