Software /
code /
prosody
Annotate
spec/util_iterators_spec.lua @ 8802:befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 18 May 2018 15:20:32 +0100 |
child | 8805:82d68951ec2a |
rev | line source |
---|---|
8802
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local iter = require "util.iterators"; |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 local set = require "util.set"; |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 describe("util.iterators", function () |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 describe("join", function () |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 it("should produce a joined iterator", function () |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 local expect = { "a", "b", "c", 1, 2, 3 }; |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 local output = {}; |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 for x in iter.join(iter.values({"a", "b", "c"})):append(iter.values({1, 2, 3})) do |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 table.insert(output, x); |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 end |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 assert.same(output, expect); |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 end); |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 end); |
befffddf1b25
Fix wrong tests committed with 7b621a4a2e8d
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 end); |