diff --git a/spec/multimap_spec.lua b/spec/multimap_spec.lua new file mode 100644 index 00000000..a911611a --- /dev/null +++ b/spec/multimap_spec.lua @@ -0,0 +1,14 @@ +local MultiMap = require("pl.MultiMap") + +describe("pl.MultiMap", function () + + it("should hold with multiple values per key", function () + local map = MultiMap() + map:set('foo', 1) + map:set('bar', 3) + map:set('foo', 2) + local expected = { foo = { 1, 2 }, bar = { 3 } } + assert.is.same(expected, map) + end) + +end) diff --git a/tests/test-multimap.lua b/tests/test-multimap.lua deleted file mode 100644 index 1cb29258..00000000 --- a/tests/test-multimap.lua +++ /dev/null @@ -1,11 +0,0 @@ -local asserteq = require 'pl.test' . asserteq -local MultiMap = require 'pl.MultiMap' - -m = MultiMap() -m:set('john',1) -m:set('jane',3) -m:set('john',2) - -local ms = MultiMap{john={1,2},jane={3}} - -asserteq(m,ms)