diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-12 03:02:14 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-12 03:02:14 +0300 |
commit | a7f64ba5171564e307de89f5b130528897887592 (patch) | |
tree | 1df266c006f086511315d3228689f36cb0044a35 /test/unit/set.lua | |
parent | bf68907778aba402ead678a6846f865d29e666d8 (diff) | |
download | rneovim-a7f64ba5171564e307de89f5b130528897887592.tar.gz rneovim-a7f64ba5171564e307de89f5b130528897887592.tar.bz2 rneovim-a7f64ba5171564e307de89f5b130528897887592.zip |
unittests: Move filtering cdefs to main process
Diffstat (limited to 'test/unit/set.lua')
-rw-r--r-- | test/unit/set.lua | 16 |
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 |