diff options
author | Christian Schneider | 2022-10-03 16:02:35 +0200 |
---|---|---|
committer | Christian Schneider | 2022-10-03 16:02:35 +0200 |
commit | 53e71626424285dbed893ee615c98fa378c30b19 (patch) | |
tree | 331d8df8ba6badbdb3af10876d3c7b779034469d /test/it.t | |
parent | 6d649237a4dae8cc6a1537902c1cfd8a3870243d (diff) | |
download | itools-53e71626424285dbed893ee615c98fa378c30b19.tar.gz itools-53e71626424285dbed893ee615c98fa378c30b19.tar.bz2 itools-53e71626424285dbed893ee615c98fa378c30b19.zip |
Fix it::map with generators which can only be used once
Diffstat (limited to 'test/it.t')
-rwxr-xr-x | test/it.t | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -490,6 +490,9 @@ is(it::map('it::ucfirst', ["aaa"]), ["Aaa"]); $dom = new DOMDocument; $dom->loadXML('<foo>42</foo>'); is(it::map('$v->C14N()', $dom->childNodes), [ '<foo>42</foo>' ], "Traversable: Needs copy, not modifiable in-place"); +# Generator function +function _generator() { foreach (range(1,2) as $v) yield $v; } +is(it::map('2*$v', _generator()), [2, 4], "Generator"); # Special values which are not callable is(it::map('null', ["aaa", "aa"]), [null, null]); is(it::map('1', ["aaa", "aa"]), [1, 1]); |