aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core/functional/data_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mason-core/functional/data_spec.lua')
-rw-r--r--tests/mason-core/functional/data_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/mason-core/functional/data_spec.lua b/tests/mason-core/functional/data_spec.lua
new file mode 100644
index 00000000..e2f8f7ee
--- /dev/null
+++ b/tests/mason-core/functional/data_spec.lua
@@ -0,0 +1,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)