diff options
author | James E Keenan <jkeenan@cpan.org> | 2022-07-20 13:49:07 +0000 |
---|---|---|
committer | ℕicolas ℝ <nicolas@atoomic.org> | 2022-07-20 14:51:07 -0600 |
commit | 924fb251e524e89ef804c71f91c5687bdfda8495 (patch) | |
tree | cb2de8144044ccc1053f51b3e3243e9caa0b68e3 /lib/builtin.t | |
parent | a9a41e90102044c0dec8a28b7a0d24a7f4a9b84d (diff) | |
download | perl-924fb251e524e89ef804c71f91c5687bdfda8495.tar.gz |
Tests for prototypes of 'builtin::*' functions
Diffstat (limited to 'lib/builtin.t')
-rw-r--r-- | lib/builtin.t | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/builtin.t b/lib/builtin.t index 6a9810e77d..03150f5796 100644 --- a/lib/builtin.t +++ b/lib/builtin.t @@ -47,6 +47,8 @@ package FetchStoreCounter { $tied = is_bool(false); is($storecount, 1, 'is_bool() invokes STORE magic'); + + is(prototype(\&builtin::is_bool), '$', 'is_bool prototype'); } # weakrefs @@ -67,6 +69,10 @@ package FetchStoreCounter { weaken($ref); undef $arr; is($ref, undef, 'ref is now undef after arr is cleared'); + + is(prototype(\&builtin::weaken), '$', 'weaken prototype'); + is(prototype(\&builtin::unweaken), '$', 'unweaken prototype'); + is(prototype(\&builtin::is_weak), '$', 'is_weak prototype'); } # reference queries @@ -91,6 +97,10 @@ package FetchStoreCounter { # blessed() appears false as a boolean on package "0" is(blessed(bless [], "0") ? "YES" : "NO", "NO", 'blessed in boolean context handles "0" cornercase'); + + is(prototype(\&builtin::blessed), '$', 'blessed prototype'); + is(prototype(\&builtin::refaddr), '$', 'refaddr prototype'); + is(prototype(\&builtin::reftype), '$', 'reftype prototype'); } # created_as_... @@ -158,6 +168,9 @@ package FetchStoreCounter { local $1; "hello" =~ m/(.*)/; ok(created_as_string($1), 'magic string'); + + is(prototype(\&builtin::created_as_string), '$', 'created_as_string prototype'); + is(prototype(\&builtin::created_as_number), '$', 'created_as_number prototype'); } # ceil, floor @@ -185,6 +198,9 @@ package FetchStoreCounter { $tied = floor(1.1); is($storecount, 1, 'floor() TARG invokes STORE magic'); + + is(prototype(\&builtin::ceil), '$', 'ceil prototype'); + is(prototype(\&builtin::floor), '$', 'floor prototype'); } # imports are lexical; should not be visible here @@ -295,6 +311,8 @@ package FetchStoreCounter { is(trim("\t\n\n\nHello world!\n \t"), "Hello world!" , 'Trim all three'); is(trim("Perl") , "Perl" , 'Trim nothing'); is(trim('') , "" , 'Trim empty string'); + + is(prototype(\&builtin::trim), '$', 'trim prototype'); } TODO: { @@ -356,6 +374,8 @@ TODO: { $tied = is_tainted($0); is($storecount, 1, 'is_tainted() invokes STORE magic'); + + is(prototype(\&builtin::is_tainted), '$', 'is_tainted prototype'); } # Lexical export |