aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core/functional/data_spec.lua
blob: e2f8f7ee8d5ee9afe1d95e17959577ed59614948 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local _ = require "mason-core.functional"

describe("functional: data", function()
    it("creates enums", function()
        local colors = _.enum {
            "BLUE",
            "YELLOW",
        }
        assert.same({
            ["BLUE"] = "BLUE",
            ["YELLOW"] = "YELLOW",
        }, colors)
    end)

    it("creates sets", function()
        local colors = _.set_of {
            "BLUE",
            "YELLOW",
            "BLUE",
            "RED",
        }
        assert.same({
            ["BLUE"] = true,
            ["YELLOW"] = true,
            ["RED"] = true,
        }, colors)
    end)
end)