3 # This file is part of GNU Stow.
5 # GNU Stow is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # GNU Stow is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see https://www.gnu.org/licenses/.
19 # Test processing of CLI options.
25 use Test
::More tests
=> 10;
35 '-d', "$TEST_DIR/stow",
36 '-t', "$TEST_DIR/target",
40 my ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options
();
42 is
($options->{verbose
}, 1, 'verbose option');
43 is
($options->{dir
}, "$TEST_DIR/stow", 'stow dir option');
45 my $stow = new_Stow
(%$options);
47 is
($stow->{stow_path
}, "../stow" => 'stow dir');
48 is_deeply
($pkgs_to_stow, [ 'dummy' ] => 'default to stow');
51 # Check mixed up package options
63 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options
();
64 is_deeply
($pkgs_to_delete, [ 'd1', 'd2', 'r1', 'd3', 'r2' ] => 'mixed deletes');
65 is_deeply
($pkgs_to_stow, [ 's1', 'r1', 's2', 's3', 'r2' ] => 'mixed stows');
68 # Check setting deferred paths
75 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options
();
76 is_deeply
($options->{defer
}, [ qr{\A(man)}, qr{\A(info)} ] => 'defer man and info');
79 # Check setting override paths
86 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options
();
87 is_deeply
($options->{override
}, [qr{\A(man)}, qr{\A(info)}] => 'override man and info');
90 # Check setting ignored paths
97 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options
();
98 is_deeply
($options->{ignore
}, [ qr{(~)\z}, qr{(\.#.*)\z} ] => 'ignore temp files');
101 # Check that expansion not applied.
104 "--target=$TEST_DIR/".'$HOME',
107 make_path
("$TEST_DIR/".'$HOME');
108 ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options
();
109 is
($options->{target
}, "$TEST_DIR/".'$HOME', 'no expansion');
110 remove_dir
("$TEST_DIR/".'$HOME');