xref: /openbsd/gnu/usr.bin/perl/cpan/autodie/t/chmod.t (revision fc61954a)
1#!/usr/bin/perl -w
2use strict;
3use Test::More tests => 4;
4use constant NO_SUCH_FILE => "this_file_had_better_not_exist";
5use autodie;
6
7# This tests RT #50423, Debian #550462
8
9eval { chmod(0755, NO_SUCH_FILE); };
10isa_ok($@, 'autodie::exception', 'exception thrown for chmod');
11
12eval { chmod(0755, $0); };
13ok(! $@, "We can chmod ourselves just fine.");
14
15eval { chmod(0755, $0, NO_SUCH_FILE) };
16isa_ok($@, 'autodie::exception', 'chmod exception on any file failure.');
17is($@->return,1,"Confirm autodie on a 'true' chown failure.");
18