3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 use Test::More tests => 5;
31 Dpkg::Exit::run_exit_handlers();
33 is($track, 0, 'no handlers run');
35 Dpkg::Exit::push_exit_handler(\&test_handler);
36 Dpkg::Exit::pop_exit_handler();
38 Dpkg::Exit::run_exit_handlers();
40 is($track, 0, 'push/pop; no handlers run');
42 Dpkg::Exit::push_exit_handler(\&test_handler);
44 Dpkg::Exit::run_exit_handlers();
46 is($track, 1, 'push; handler run');
48 # Check the exit handlers, must be the last thing done.
50 pass('exit handler invoked');
54 Dpkg::Exit::push_exit_handler(\&exit_handler);