Software /
code /
prosody
Comparison
spec/util_envload_spec.lua @ 11489:37f49d0ad22c
util.envload: Add basic test of envload()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Mar 2021 13:03:22 +0100 |
comparison
equal
deleted
inserted
replaced
11488:332c9291f4d5 | 11489:37f49d0ad22c |
---|---|
1 describe("util.envload", function() | |
2 local envload = require "util.envload"; | |
3 describe("envload()", function() | |
4 it("works", function() | |
5 local f, err = envload.envload("return 'hello'", "@test", {}); | |
6 assert.is_function(f, err); | |
7 local ok, ret = pcall(f); | |
8 assert.truthy(ok); | |
9 assert.equal("hello", ret); | |
10 end); | |
11 it("lets you pass values in and out", function () | |
12 local f, err = envload.envload("return thisglobal", "@test", { thisglobal = "yes, this one" }); | |
13 assert.is_function(f, err); | |
14 local ok, ret = pcall(f); | |
15 assert.truthy(ok); | |
16 assert.equal("yes, this one", ret); | |
17 | |
18 end); | |
19 | |
20 end) | |
21 -- TODO envloadfile() | |
22 end) |