summaryrefslogtreecommitdiff
path: root/t/lib/autodie/open.t
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/autodie/open.t')
-rw-r--r--t/lib/autodie/open.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/lib/autodie/open.t b/t/lib/autodie/open.t
new file mode 100644
index 0000000000..3a2d493c49
--- /dev/null
+++ b/t/lib/autodie/open.t
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+use strict;
+
+use Test::More 'no_plan';
+
+use constant NO_SUCH_FILE => "this_file_had_better_not_exist";
+
+use autodie;
+
+eval { open(my $fh, '<', NO_SUCH_FILE); };
+ok($@, "3-arg opening non-existent file fails");
+like($@, qr/for reading/, "Well-formatted 3-arg open failure");
+
+eval { open(my $fh, "< ".NO_SUCH_FILE) };
+ok($@, "2-arg opening non-existent file fails");
+
+like($@, qr/for reading/, "Well-formatted 2-arg open failure");
+unlike($@, qr/GLOB\(0x/, "No ugly globs in 2-arg open messsage");