| | 115 | # http://trac.parrot.org/parrot/ticket/467 |
| | 116 | # |
| | 117 | # If a method is declared in a pmclass declaration it should |
| | 118 | # not be appear in the pmclass namespace but it should be accessible |
| | 119 | # using find_method on a pmc instance. |
| | 120 | # |
| | 121 | # When a pmc method sub can be retrieved through a namespace |
| | 122 | # it should return true with "defined". This was a bug. (remove test |
| | 123 | # when retrieval of method subs through namespace issue settled?) |
| | 124 | |
| | 125 | pir_output_is( <<'CODE', <<'OUTPUT', 'find_method' ); |
| | 126 | .sub main :main |
| | 127 | $P0 = new [ 'String' ] |
| | 128 | $P0 = 'AbC' |
| | 129 | $P2 = $P0.'lower'() |
| | 130 | say $P2 |
| | 131 | |
| | 132 | push_eh _failed |
| | 133 | $P1 = find_method $P0, 'lower' |
| | 134 | say 'find_method ran' |
| | 135 | $P2 = $P1($P0) |
| | 136 | say $P2 |
| | 137 | goto _ns_test |
| | 138 | |
| | 139 | _failed: |
| | 140 | say 'find_method failed' |
| | 141 | |
| | 142 | _ns_test: |
| | 143 | $P1 = get_hll_global [ 'String' ], 'lower' |
| | 144 | |
| | 145 | $P0 = 'AbC' |
| | 146 | push_eh _failed2 |
| | 147 | $P2 = $P1($P0) |
| | 148 | print 'lower from namespace ' |
| | 149 | print $P2 |
| | 150 | say ' - ran - problem' |
| | 151 | goto _done |
| | 152 | |
| | 153 | _failed2: |
| | 154 | say 'method from namespace did not run ok' |
| | 155 | |
| | 156 | _done: |
| | 157 | # definedness failing for sub pmcs |
| | 158 | $I0 = defined $P1 |
| | 159 | say $I0 |
| | 160 | .end |
| | 161 | CODE |
| | 162 | abc |
| | 163 | find_method ran |
| | 164 | abc |
| | 165 | method from namespace did not run ok |
| | 166 | 1 |
| | 167 | OUTPUT |
| | 168 | |
| | 169 | |