Diff

spec/util_iterators_spec.lua @ 12744:e894677359e5

util.iterators: join: Work even with only a single iterator in the chain
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Oct 2022 18:34:40 +0100
parent 9328:a9592107021b
line wrap: on
line diff
--- a/spec/util_iterators_spec.lua	Thu Oct 06 16:00:39 2022 +0100
+++ b/spec/util_iterators_spec.lua	Thu Oct 06 18:34:40 2022 +0100
@@ -10,6 +10,14 @@
 			end
 			assert.same(output, expect);
 		end);
+		it("should work with only a single iterator", function ()
+			local expect = { "a", "b", "c" };
+			local output = {};
+			for x in iter.join(iter.values({"a", "b", "c"})) do
+				table.insert(output, x);
+			end
+			assert.same(output, expect);
+		end);
 	end);
 
 	describe("sorted_pairs", function ()