Diff

spec/util_table_spec.lua @ 12404:082f38e9de64

util.table: tests: Tests for table.move()
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 Mar 2022 15:24:12 +0000
parent 9727:9a35ae935390
child 12942:54756e3a54b9
line wrap: on
line diff
--- a/spec/util_table_spec.lua	Fri Mar 18 15:22:00 2022 +0000
+++ b/spec/util_table_spec.lua	Fri Mar 18 15:24:12 2022 +0000
@@ -12,6 +12,17 @@
 			assert.same({ "lorem", "ipsum", "dolor", "sit", "amet", n = 5 }, u_table.pack("lorem", "ipsum", "dolor", "sit", "amet"));
 		end);
 	end);
+
+	describe("move()", function ()
+		it("works", function ()
+			local t1 = { "apple", "banana", "carrot" };
+			local t2 = { "cat", "donkey", "elephant" };
+			local t3 = {};
+			u_table.move(t1, 1, 3, 1, t3);
+			u_table.move(t2, 1, 3, 3, t3);
+			assert.same({ "apple", "banana", "cat", "donkey", "elephant" }, t3);
+		end);
+	end);
 end);