-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-luarocks.sh.html
53 lines (48 loc) · 1.22 KB
/
test-luarocks.sh.html
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
49
50
51
52
53
<html>
<body>
<h1><a href="test-luarocks.sh"><code>test-luarocks.sh</code></a></h1>
<pre>
#!/bin/bash
################################
# Lua versions
declare -a luaversions=(5.4 5.3)
################################
# Lua rocks to check: a list of "ROCK [MODULE]*"
# ROCK is a name of a rock
# each MODULE is a name of a module to be require()'d in lua
declare -a rockinfos=(
"argparse argparse"
"lua-cjson cjson cjson.util"
)
################################
# Test
a () { shift $1 || return 1; printf '%s' "$1"; }
d () { shift $1 && shift || return 1; printf '%s ' "$@"; }
do_test () {
local v rockinfo rock mods m
for v in "${luaversions[@]}"; do
for rockinfo in "${rockinfos[@]}"; do
rock=$(a 1 $rockinfo)
mods=$(d 1 $rockinfo)
echo '*** Check:' $rockinfo \
&& (
set -x \
&& luarocks-${v} install $rock \
&& luarocks-${v} list \
&& for m in $mods; do lua${v} -e 'require("'"$m"'")' && : OK ; done \
&& luarocks-${v} remove $rock \
) \
&& echo '*** OK:' $rockinfo \
|| echo '*** FAIL:' $rockinfo \
|| :
echo
done
done
}
################################
# Do test
do_test
################################
</pre>
</body>
</html>