Software /
code /
prosody
Changeset
12404:082f38e9de64
util.table: tests: Tests for table.move()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 18 Mar 2022 15:24:12 +0000 |
parents | 12403:42b2713ab818 |
children | 12405:308ed64dc69b |
files | spec/util_table_spec.lua |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
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);