Skip to content

Commit ac2146d

Browse files
authored
Merge pull request #2261 from tritao/fix-table-merge
Add tests for `table.merge`.
2 parents ac4ef40 + 645f7b8 commit ac2146d

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

tests/base/test_table.lua

+14
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,17 @@
9595
test.istrue(t[4] == 5)
9696
test.istrue(t[5] == 8)
9797
end
98+
99+
--
100+
-- table.merge() tests
101+
--
102+
103+
function suite.merge()
104+
t = { a = 1, b = 2 }
105+
t2 = { c = 3, d = 4 }
106+
test.isequal({ a = 1, b = 2, c = 3, d = 4 }, table.merge(t, t2))
107+
108+
t = { a = 1, b = 2 }
109+
t2 = { c = 3, d = 4, e = { a = 5 } }
110+
test.isequal({ a = 1, b = 2, c = 3, d = 4, e = { a = 5 } }, table.merge(t, t2))
111+
end

website/docs/table.join.md

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ A new array containing all of the values in order.
1919

2020
Premake 5.0 or later.
2121

22+
### See Also ###
23+
24+
* [table.merge](table.merge.md)

website/docs/table.merge.md

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ A new table containing the key-value pairs from each input table, from first to
1818

1919
Premake 5.0 or later.
2020

21+
### See Also ###
22+
23+
* [table.join](table.join.md)

0 commit comments

Comments
 (0)