1#!./perl 2 3BEGIN { 4 unless (-d 'blib') { 5 chdir 't' if -d 't'; 6 } 7 require q(./test.pl); 8 set_up_inc('../lib'); 9} 10 11use strict; 12use warnings; 13use utf8; 14use open qw( :utf8 :std ); 15 16plan(tests => 24); 17 18use mro; 19 20sub i { 21 my @args = @_; 22 @_ 23 = ( 24 join(" ", sort @{mro::get_isarev $args[0]}), 25 join(" ", sort @args[1..$#args-1]), 26 pop @args 27 ); 28 goto &is; 29} 30 31# Basic isarev updating, when @ISA changes 32@팟tРṉ::ISA = "B옫yპt::ぅงலҬ"; 33@S추ঋ::ISA = "B옫yპt::ぅงலҬ"; 34@B옫yპt::ぅงலҬ::ISA = "B옫yპt"; 35i B옫yპt => qw [ B옫yპt::ぅงலҬ 팟tРṉ S추ঋ ], 36 'subclasses and subsubclasses are added to isarev'; 37@팟tРṉ::ISA = (); 38i B옫yპt => qw [ B옫yპt::ぅงலҬ S추ঋ ], 39 'single deletion from isarev'; 40@B옫yპt::ぅงலҬ::ISA = (); 41i B옫yპt => qw [ ], 'recursive deletion from isarev'; 42 # except underneath it is not actually recursive 43 44 45# More complicated tests that move packages around 46 47@훗ㄎએỲ::ISA = "독"; 48@독::ISA = "ㄘა읻"; 49@ວlƑ::ISA = "ㄘა읻"; 50@솜ェ::ƀ란ƌ::ᚿamㅔ::ISA = "독::ㄅ"; 51@독::ㄅ::ISA = "TレӔṪ"; 52@Frȇe::팀ẽ::ISA = "TレӔṪ"; 53@My촐ꡙʳ::ISA = "독::ցളŔ::Leaʇhㄦ"; 54@독::ցളŔ::Leaʇhㄦ::ISA = "ցളŔ"; 55@AŇℴtḫeᕃ::ցളŔ::ISA = "ցളŔ"; 56*팈ዕ:: = *독::; 57delete $::{"독::"}; 58i ㄘა읻=>qw[ ວlƑ 팈ዕ ], 59 "deleting a stash elem updates isarev entries"; 60i TレӔṪ=>qw[ Frȇe::팀ẽ 팈ዕ::ㄅ ], 61 "deleting a nested stash elem updates isarev entries"; 62i ցളŔ=>qw[ AŇℴtḫeᕃ::ցളŔ 팈ዕ::ցളŔ::Leaʇhㄦ ], 63 "deleting a doubly nested stash elem updates isarev entries"; 64 65@ごଅt::ISA = "ぅงலҬ"; 66@ごଅt::DଐɾẎ::ISA = "ごଅt"; 67@ごଅt::DଐɾẎ::Ⱦ옥ゲᕟƃᚒḠ::ISA = "ごଅt::DଐɾẎ"; 68@웨ɪrƌ::ጢᶯᵷ::ISA = "g"; 69*g:: = *ごଅt::; 70i ごଅt => qw[ ごଅt::DଐɾẎ ごଅt::DଐɾẎ::Ⱦ옥ゲᕟƃᚒḠ 웨ɪrƌ::ጢᶯᵷ ], 71 "isarev includes subclasses of aliases"; 72delete $::{"g::"}; 73i ぅงலҬ => qw[ ごଅt ごଅt::DଐɾẎ ごଅt::DଐɾẎ::Ⱦ옥ゲᕟƃᚒḠ ], 74 "deleting an alias to a package updates isarev entries"; 75i"ごଅt" => qw[ ごଅt::DଐɾẎ ごଅt::DଐɾẎ::Ⱦ옥ゲᕟƃᚒḠ ], 76 "deleting an alias to a package updates isarev entries of nested stashes"; 77i"ごଅt::DଐɾẎ" => qw[ ごଅt::DଐɾẎ::Ⱦ옥ゲᕟƃᚒḠ ], 78 "deleting an stash alias updates isarev entries of doubly nested stashes"; 79i g => qw [ 웨ɪrƌ::ጢᶯᵷ ], 80 "subclasses of the deleted alias become part of its isarev"; 81 82@챂린ẽ::ISA = "Hഓf엗::맘말"; 83@챂린ẽ::DଐɾẎ::ISA = "챂린ẽ"; 84@챂린ẽ::DଐɾẎ::Obェʶ핫l::ISA = "챂린ẽ::DଐɾẎ"; 85@ẂhaƮᵋቭȓ::ISA = "챂린ẽ"; 86*챂릳:: = *챂린ẽ::; 87*챂린ẽ:: = *ㄔɘvレ::; 88i"Hഓf엗::맘말" => qw[ 챂릳 ], 89 "replacing a stash updates isarev entries"; 90i ㄔɘvレ => qw[ 챂릳::DଐɾẎ ẂhaƮᵋቭȓ ], 91 "replacing nested stashes updates isarev entries"; 92 93@ᛑiስアsઍ::ェᔦ::ISA = "ᛑiስアsઍ"; 94@ᛑiስアsઍ::ェᔦ::Iṇᚠctĭo웃::ISA = "ᛑiስアsઍ::ェᔦ"; 95@Kㄦat옻onj운ctᝁヸቲᔈ::ISA = "ᛑiስアsઍ::Opɥt할및::Iṇᚠctĭo웃"; 96*ᛑiስアsઍ::Opɥt할및:: = *ᛑiስアsઍ::ェᔦ::; 97{package 솜e_란돔_new_symbol::Iṇᚠctĭo웃} # autovivify 98*ᛑiስアsઍ::Opɥt할및:: = *솜e_란돔_new_symbol::; 99i ᛑiስアsઍ => qw[ ᛑiስアsઍ::ェᔦ ᛑiስアsઍ::ェᔦ::Iṇᚠctĭo웃 ], 100 "replacing an alias of a stash updates isarev entries"; 101i"ᛑiስアsઍ::ェᔦ" => qw[ ᛑiስアsઍ::ェᔦ::Iṇᚠctĭo웃 ], 102 "replacing an alias of a stash containing another updates isarev entries"; 103i"솜e_란돔_new_symbol::Iṇᚠctĭo웃" => qw[ Kㄦat옻onj운ctᝁヸቲᔈ ], 104 "replacing an alias updates isarev of stashes nested in the replacement"; 105 106# Globs ending with :: have autovivified stashes in them by default. We 107# want one without a stash. 108undef *Eṁptᔾ::; 109@눌Ļ::ISA = "Eṁptᔾ"; 110@눌Ļ::눌Ļ::ISA = "Eṁptᔾ::Eṁptᔾ"; 111{package ዚlcᕻ::Eṁptᔾ} # autovivify it 112*Eṁptᔾ:: = *ዚlcᕻ::; 113i ዚlcᕻ => qw[ 눌Ļ ], "assigning to an empty spot updates isarev"; 114i"ዚlcᕻ::Eṁptᔾ" => qw[ 눌Ļ::눌Ļ ], 115 "assigning to an empty spot updates isarev of nested packages"; 116 117# Classes inheriting from multiple classes that get moved in a single 118# assignment. 119@ᕘ::ISA = ("ᵇ", "ᵇ::ᵇ"); 120{package अ::ᵇ} 121my $अ = \%अ::; # keep a ref 122*अ:: = 'whatever'; # clobber it 123*ᵇ:: = $अ; # assign to two superclasses of ᕘ at the same time 124# There should be no अ::ᵇ isarev entry. 125i"अ::ᵇ" => qw [], 'assigning to two superclasses at the same time'; 126ok !ᕘ->isa("अ::ᵇ"), 127 "A class must not inherit from its superclass’s former name"; 128 129# undeffing globs 130@α::ISA = 'β'; 131$_ = \*α::ISA; # hang on to the glob 132undef *α::ISA; 133i β => qw [], "undeffing an ISA glob deletes isarev entries"; 134@aᙇ::ISA = '붘ㆉ'; 135$_ = \*aᙇ::ISA; 136undef *aᙇ::; 137i 붘ㆉ => qw [], "undeffing a package glob deletes isarev entries"; 138 139# Package aliasing/clobbering when the clobbered package has grandchildren 140# by inheritance. 141@Ƚ::ISA = 'ภɵ'; 142@숩Ȼl았A::ISA = "숩Ȼl았Ƃ"; 143@숩Ȼl았Ƃ::ISA = "Ƚ"; 144*Ƚ:: = *bᚪᶼ::; 145i ภɵ => qw [], 146 'clobbering a class w/multiple layers of subclasses updates its parent'; 147 148@ᖭ랕::ISA = 'S민'; 149%ᖭ랕:: = (); 150i S민 => qw [], '%Package:: list assignment'; 151