[go: up one dir, main page]

File: filter.t

package info (click to toggle)
unburden-home-dir 0.3.3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 744 kB
  • ctags: 806
  • sloc: perl: 1,337; makefile: 31; sh: 15
file content (58 lines) | stat: -rw-r--r-- 1,755 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!perl

use strict;
use warnings;

use lib qw(t/lib lib);
use Test::UBH;
my $t = Test::UBH->new;

$t->setup_test_environment('');

# Forward test
file_not_exists_ok( $t->TP."-foobar-fnord" );
$t->write_configs("r F .foobar/fnord foobar-fnord\n".
                  "r F .foobar/gnarz foobar-gnarz\n");
$t->call_unburden_home_dir_default(qw(-f fnord));
$t->eq_lsof_warning_or_diff_stderr;

my $wanted = "Touching ".$t->TP."-foobar-fnord
Create parent directories for ".$t->HOME."/.foobar/fnord
mkdir ".$t->HOME."/.foobar
Symlinking ".$t->HOME."/.foobar/fnord -> ".$t->TP."-foobar-fnord
";
$t->eq_or_diff_stdout($wanted);

file_exists_ok( $t->TP."-foobar-fnord" );
dir_exists_ok( $t->HOME."/.foobar" );
symlink_target_exists_ok( $t->HOME."/.foobar/fnord" );
file_not_exists_ok( $t->TP."-foobar-gnarz" );

# Intermediate step
$t->call_unburden_home_dir_default;
file_exists_ok( $t->TP."-foobar-fnord" );

# Backward test
$t->call_unburden_home_dir_default(qw(-u -f fnord));
$t->eq_lsof_warning_or_diff_stderr;

$wanted = "Trying to revert ".$t->TP."-foobar-fnord to ".
$t->HOME."/.foobar/fnord
Removing symlink ".$t->HOME."/.foobar/fnord
Moving ".$t->TP."-foobar-fnord -> ".$t->HOME."/.foobar/fnord
'".$t->TP."-foobar-fnord' -> '".$t->HOME."/.foobar/fnord'
";
$t->eq_or_diff_stdout($wanted);

file_not_exists_ok( $t->TP."-foobar-fnord" );
file_exists_ok( $t->TP."-foobar-gnarz" );
dir_exists_ok( $t->HOME."/.foobar" );
symlink_target_exists_ok( $t->HOME."/.foobar/gnarz" );

# Must bailout with broken filter argument
$t->write_configs("r F .foobar/fnord foobar-fnord");
$t->fail_unburden_home_dir_default(qw[-f '(']);
$t->eq_or_diff_stderr("ERROR: Can't handle parameter to -f: ( ".
                      'at unburden-home-dir line <n>.'."\n");

$t->done();