summaryrefslogtreecommitdiff
path: root/tests/modules/table
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-14 22:51:32 +0800
committerruki <[email protected]>2021-11-14 22:51:32 +0800
commit8ea70c741c233e8ddc1523cc8f2e91eb7baa2de7 (patch)
tree63790e889168914c523e85901d3cae3c97aef81a /tests/modules/table
parent3a6d721b691b8235dd6189d6e24a59537640f702 (diff)
add table.remove_if
Diffstat (limited to 'tests/modules/table')
-rw-r--r--tests/modules/table/test.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/modules/table/test.lua b/tests/modules/table/test.lua
new file mode 100644
index 000000000..fc17fcb62
--- /dev/null
+++ b/tests/modules/table/test.lua
@@ -0,0 +1,4 @@
+function test_remove_if(t)
+ t:are_equal(table.remove_if({1, 2, 3, 4, 5, 6}, function (t, i, v) return (v % 2) == 0 end), {1, 3, 5})
+ t:are_equal(table.remove_if({a = 1, b = 2, c = 3}, function (t, i, v) return (v % 2) == 0 end), {a = 1, c = 3})
+end