-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathrusile_spec.lua
48 lines (39 loc) · 1.27 KB
/
rusile_spec.lua
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SILE = require("core.sile")
local rusile = require("rusile")
local callable = require("luassert.util").callable
describe("rusile", function ()
it("should exist", function ()
assert.is.truthy(rusile)
end)
describe("semver", function ()
local semver = rusile.semver
it("constructor should exist", function ()
assert.is.truthy(callable(semver))
end)
describe("instance", function ()
local a = semver("1.3.5")
local b = semver("1.3.5")
local c = semver("2.4.6")
it("should evaluate comparisons", function ()
assert.is.equal(a, b)
assert.is.truthy(a == b)
assert.is_not.equal(a, c)
assert.is_not.truthy(a == c)
assert.is.truthy(a < c)
assert.is.truthy(c > b)
assert.is.truthy(a <= b)
assert.is.truthy(c >= b)
end)
end)
end)
describe("setenv", function ()
local setenv = rusile.setenv
it("should effectively set variables before executing system commands", function ()
local before = os.getenv("FOO")
assert.is.equal(type(before), "nil")
setenv("FOO", "bar")
local after = os.getenv("FOO")
assert.is.equal(after, "bar")
end)
end)
end)