aboutsummaryrefslogtreecommitdiff
path: root/test/unit/set.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-12 10:52:13 +0100
committerGitHub <noreply@github.com>2017-03-12 10:52:13 +0100
commitc8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c (patch)
treed993945c472a610a265baa79d714c6d32f149f14 /test/unit/set.lua
parentb2b15e6e137d7be2b01bf2174791f36bd12981bd (diff)
parent48e7a83447c0a1a59a110b5ca9e712f560fd9e03 (diff)
downloadrneovim-c8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c.tar.gz
rneovim-c8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c.tar.bz2
rneovim-c8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c.zip
Merge #6214 from ZyX-I/split-eval'/isolated-unittests
Run all unit tests in separate processes
Diffstat (limited to 'test/unit/set.lua')
-rw-r--r--test/unit/set.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/set.lua b/test/unit/set.lua
index 4e66546f32..f3d68c3042 100644
--- a/test/unit/set.lua
+++ b/test/unit/set.lua
@@ -26,6 +26,22 @@ function Set:new(items)
return obj
end
+function Set:copy()
+ local obj = {}
+ obj.nelem = self.nelem
+ obj.tbl = {}
+ obj.items = {}
+ for k, v in pairs(self.tbl) do
+ obj.tbl[k] = v
+ end
+ for k, v in pairs(self.items) do
+ obj.items[k] = v
+ end
+ setmetatable(obj, Set)
+ obj.__index = Set
+ return obj
+end
+
-- adds the argument Set to this Set
function Set:union(other)
for e in other:iterator() do