diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2023-02-09 14:45:20 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2023-02-10 12:07:02 +0000 |
commit | ca8d92cfddc9cc3d4904712f7e0dfc3b2598561d (patch) | |
tree | 7cd889ad35d1adc69805fd67c19d0c066af7f54d /t | |
parent | 24c33697796a1556af3f58e15fc4fb6b0d1538dc (diff) | |
download | perl-ca8d92cfddc9cc3d4904712f7e0dfc3b2598561d.tar.gz |
Disallow bless hackery around classes and instances
Diffstat (limited to 't')
-rw-r--r-- | t/lib/croak/class | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/t/lib/croak/class b/t/lib/croak/class index 2b564ee15e..e512282588 100644 --- a/t/lib/croak/class +++ b/t/lib/croak/class @@ -34,10 +34,17 @@ Cannot invoke a method of "XXX" on an instance of "YYY" at - line 6. ######## no warnings 'experimental::class'; use feature 'class'; -class XXX { method m { } } -(bless {}, "XXX")->m() +class XXX {} +bless [], "XXX"; +EXPECT +Attempt to bless into a class at - line 4. +######## +no warnings 'experimental::class'; +use feature 'class'; +class XXX {} +bless(XXX->new, "main"); EXPECT -Cannot invoke method "m" on a non-instance at - line 4. +Can't bless an object reference at - line 4. ######## no warnings 'experimental::class'; use feature 'class'; |