This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The 2nd arg to save_alloc() must be cast to I32 to avoid pointer truncation warnings...
[perl5.git] / lib / autodie / t / open.t
CommitLineData
0b09a93a
PF
1#!/usr/bin/perl -w
2use strict;
3
4use Test::More 'no_plan';
5
6use constant NO_SUCH_FILE => "this_file_had_better_not_exist";
7
8use autodie;
9
10eval { open(my $fh, '<', NO_SUCH_FILE); };
11ok($@, "3-arg opening non-existent file fails");
12like($@, qr/for reading/, "Well-formatted 3-arg open failure");
13
14eval { open(my $fh, "< ".NO_SUCH_FILE) };
15ok($@, "2-arg opening non-existent file fails");
16
17like($@, qr/for reading/, "Well-formatted 2-arg open failure");
18unlike($@, qr/GLOB\(0x/, "No ugly globs in 2-arg open messsage");