summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2011-11-28 22:57:34 +1100
committerTony Cook <tony@develop-help.com>2011-12-10 13:02:43 +1100
commit7a44ba35de261d00c7309100a861cb33b4a0152b (patch)
treefb3fbb5207e2f5e4c823751444f48ae896961ccc /t
parent59e3875574a8b5ab5b5ec16210aa9fbbdc3919cb (diff)
downloadperl-7a44ba35de261d00c7309100a861cb33b4a0152b.tar.gz
test for various fatal messages from op.c
Diffstat (limited to 't')
-rw-r--r--t/lib/croak/op44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/lib/croak/op b/t/lib/croak/op
new file mode 100644
index 0000000000..d47e8287fa
--- /dev/null
+++ b/t/lib/croak/op
@@ -0,0 +1,44 @@
+__END__
+# NAME OP_HELEM fields
+package Foo;
+use fields qw(a b);
+sub new {
+ my $class = shift;
+ return fields::new($class);
+}
+my Foo $f = Foo->new;
+$f->{c} = 1;
+EXPECT
+No such class field "c" in variable $f of type Foo at - line 8.
+########
+# NAME OP_HSLICE fields
+package Foo;
+use fields qw(a b);
+sub new {
+ my $class = shift;
+ return fields::new($class);
+}
+my Foo $f = Foo->new;
+@$f{"a", "c"} = ( 1, 2 );
+EXPECT
+No such class field "c" in variable $f of type Foo at - line 8.
+########
+# NAME my sub
+my sub foo { }
+EXPECT
+"my sub" not yet implemented at - line 1.
+########
+# NAME delete BAD
+delete $x;
+EXPECT
+delete argument is not a HASH or ARRAY element or slice at - line 1.
+########
+# NAME exists BAD
+exists $x;
+EXPECT
+exists argument is not a HASH or ARRAY element or a subroutine at - line 1.
+########
+# NAME exists non-sub
+exists &foo()
+EXPECT
+exists argument is not a subroutine name at - line 1.