Bump version to 2.1.1
[gnu-stow.git] / t / stow.t
blobeddcd838692cfbf3ae834e472959aa9e2d8fa2be
1 #!/usr/local/bin/perl
4 # Testing core application
7 use strict;
8 use warnings;
10 use Test::More tests => 9;
12 use testutil;
14 require 'stow';
16 init_test_dirs();
18 local @ARGV = (
19 '-v',
20 "-d $OUT_DIR/stow",
21 "-t $OUT_DIR/target",
22 'dummy'
25 my ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
27 is($options->{verbose}, 1, 'verbose option');
28 is($options->{dir}, "$OUT_DIR/stow", 'stow dir option');
30 my $stow = new_Stow(%$options);
32 is($stow->{stow_path}, "../stow" => 'stow dir');
33 is_deeply($pkgs_to_stow, [ 'dummy' ] => 'default to stow');
36 # Check mixed up package options
38 local @ARGV = (
39 '-v',
40 '-D', 'd1', 'd2',
41 '-S', 's1',
42 '-R', 'r1',
43 '-D', 'd3',
44 '-S', 's2', 's3',
45 '-R', 'r2',
48 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
49 is_deeply($pkgs_to_delete, [ 'd1', 'd2', 'r1', 'd3', 'r2' ] => 'mixed deletes');
50 is_deeply($pkgs_to_stow, [ 's1', 'r1', 's2', 's3', 'r2' ] => 'mixed stows');
53 # Check setting deferred paths
55 local @ARGV = (
56 '--defer=man',
57 '--defer=info',
58 'dummy'
60 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
61 is_deeply($options->{defer}, [ qr(\Aman), qr(\Ainfo) ] => 'defer man and info');
64 # Check setting override paths
66 local @ARGV = (
67 '--override=man',
68 '--override=info',
69 'dummy'
71 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
72 is_deeply($options->{override}, [qr(\Aman), qr(\Ainfo)] => 'override man and info');
75 # Check setting ignored paths
77 local @ARGV = (
78 '--ignore=~',
79 '--ignore=\.#.*',
80 'dummy'
82 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
83 is_deeply($options->{ignore}, [ qr(~\z), qr(\.#.*\z) ] => 'ignore temp files');
86 # vim:ft=perl