From 53e71626424285dbed893ee615c98fa378c30b19 Mon Sep 17 00:00:00 2001
From: Christian Schneider
Date: Mon, 3 Oct 2022 16:02:35 +0200
Subject: Fix it::map with generators which can only be used once
---
test/it.t | 3 +++
1 file changed, 3 insertions(+)
(limited to 'test')
diff --git a/test/it.t b/test/it.t
index 0aee958..7733c00 100755
--- a/test/it.t
+++ b/test/it.t
@@ -490,6 +490,9 @@ is(it::map('it::ucfirst', ["aaa"]), ["Aaa"]);
$dom = new DOMDocument;
$dom->loadXML('42');
is(it::map('$v->C14N()', $dom->childNodes), [ '42' ], "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]);
--
cgit v1.2.3