| | 99 | # |
| | 100 | # If a method is declared in a pmclass declaration it should |
| | 101 | # not be appear in the pmclass namespace but it should be accessible |
| | 102 | # using find_method on a pmc instance. |
| | 103 | # |
| | 104 | # Currently a pmc method sub can be retrieved through a namespace |
| | 105 | # but does not return true with "defined". This is a bug. (remove test |
| | 106 | # when others pass?) |
| | 107 | # |
| | 108 | |
| | 109 | pir_output_is( <<'CODE', <<'OUTPUT', 'find_method' ); |
| | 110 | .sub main :main |
| | 111 | $P0 = new [ 'String' ] |
| | 112 | $P0 = 'AbC' |
| | 113 | $P2 = $P0.'lower'() |
| | 114 | say $P2 |
| | 115 | |
| | 116 | push_eh _failed |
| | 117 | $P1 = find_method $P0, 'lower' |
| | 118 | say 'find_method ran' |
| | 119 | goto _failed1 |
| | 120 | |
| | 121 | _failed: |
| | 122 | say 'find_method failed' |
| | 123 | |
| | 124 | $P1 = get_hll_global [ 'String' ], 'lower' |
| | 125 | |
| | 126 | $P0 = 'AbC' |
| | 127 | push_eh _failed1 |
| | 128 | $P2 = $P1($P0) |
| | 129 | print 'lower from namespace ' |
| | 130 | print $P2 |
| | 131 | say ' - ran - problem' |
| | 132 | goto _done |
| | 133 | |
| | 134 | _failed1: |
| | 135 | say 'method from namespace did not run ok' |
| | 136 | |
| | 137 | _done: |
| | 138 | # definedness failing for sub pmcs |
| | 139 | $I0 = defined $P1 |
| | 140 | say $I0 |
| | 141 | .end |
| | 142 | CODE |
| | 143 | abc |
| | 144 | find_method ran |
| | 145 | method from namespace did not run ok |
| | 146 | 1 |
| | 147 | OUTPUT |
| | 148 | |
| | 149 | |