-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.lua
44 lines (38 loc) · 847 Bytes
/
test.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
local lu = require("luaunit")
local shexpand = require("shexpand")
function TestBasic()
lu.assertItemsEquals(shexpand.expand("a.{js,ts}"), { "a.js", "a.ts" })
lu.assertItemsEquals(
shexpand.expand("foo.{test,spec}.ts"),
{ "foo.test.ts", "foo.spec.ts" }
)
end
function TestMultipleExpansions()
lu.assertItemsEquals(shexpand.expand("hi.{spec,test}.{js,ts}"), {
"hi.spec.js",
"hi.spec.ts",
"hi.test.js",
"hi.test.ts",
})
end
function TestEmptyExpansion()
lu.assertItemsEquals(shexpand.expand("foo.gz{,ip}"), {
"foo.gz",
"foo.gzip",
})
end
function TestEntireString()
lu.assertItemsEquals(shexpand.expand("{js,cjs,mjs}"), {
"js",
"cjs",
"mjs",
})
end
function TestNonAlpha()
lu.assertItemsEquals(shexpand.expand("foo.{1,++,my-thing}"), {
"foo.1",
"foo.++",
"foo.my-thing",
})
end
os.exit(lu.LuaUnit.run())