Comparison

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
comparison
equal deleted inserted replaced
12403:42b2713ab818 12404:082f38e9de64
10 describe("pack()", function () 10 describe("pack()", function ()
11 it("works", function () 11 it("works", function ()
12 assert.same({ "lorem", "ipsum", "dolor", "sit", "amet", n = 5 }, u_table.pack("lorem", "ipsum", "dolor", "sit", "amet")); 12 assert.same({ "lorem", "ipsum", "dolor", "sit", "amet", n = 5 }, u_table.pack("lorem", "ipsum", "dolor", "sit", "amet"));
13 end); 13 end);
14 end); 14 end);
15
16 describe("move()", function ()
17 it("works", function ()
18 local t1 = { "apple", "banana", "carrot" };
19 local t2 = { "cat", "donkey", "elephant" };
20 local t3 = {};
21 u_table.move(t1, 1, 3, 1, t3);
22 u_table.move(t2, 1, 3, 3, t3);
23 assert.same({ "apple", "banana", "cat", "donkey", "elephant" }, t3);
24 end);
25 end);
15 end); 26 end);
16 27
17 28