aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml2
-rwxr-xr-xbuild.sh2
-rw-r--r--src/lpm.lua7
-rw-r--r--t/run.lua13
4 files changed, 13 insertions, 11 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9dd10c6..84f627e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -21,7 +21,7 @@ jobs:
cp lpm lpm.x86_64-linux
- name: Run Tests
run: |
- ./lpm && gcc -O3 -Ilib/lua lib/lua/onelua.c -DMAKE_LUA -DLUA_USE_LINUX -lm -ldl -o lua && ./lua t/run.lua
+ ./lpm test t/run.lua
# - name: Package Debian/Ubuntu
# env: { ARCH: "amd64", DESCRIPTION: "A plugin manager for the lite-xl text editor.", MAINTAINER: "Adam Harrison <adamdharrison@gmail.com>" }
# run: |
diff --git a/build.sh b/build.sh
index 6589c04..5bfbff1 100755
--- a/build.sh
+++ b/build.sh
@@ -43,7 +43,7 @@ if [[ "$@" == *"-DLPM_STATIC"* ]]; then
xxd -i src/lpm.luac > src/lpm.lua.c
fi
-[[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && LDFLAGS="$LDFLAGS -ldl"
+[[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && CFLAGS="$CFLAGS -DLUA_USE_LINUX" && LDFLAGS="$LDFLAGS -ldl"
[[ $OSTYPE == 'msys'* || $CC == *'mingw'* ]] && LDFLAGS="$LDFLAGS -lbcrypt -lws2_32 -lz -lwinhttp -lole32 -lcrypt32 -lrpcrt4"
[[ $OSTYPE == *'darwin'* ]] && LDFLAGS="$LDFLAGS -liconv -framework Security -framework Foundation"
diff --git a/src/lpm.lua b/src/lpm.lua
index faafdea..1601bee 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -1370,7 +1370,7 @@ local function lpm_lite_xl_run(version, ...)
end
local bottle = Bottle.new(lite_xl, addons)
if not bottle:is_constructed() then bottle:construct() end
- bottle:run(common.splice(arguments, i + 1))
+ bottle:run(common.slice(arguments, i + 1))
end
@@ -1799,6 +1799,11 @@ in any circumstance unless explicitly supplied.
-- Small utility functions that don't play into the larger app; are used for testing
-- or for handy scripts.
+ if ARGS[2] == "test" then
+ rawset(_G, "arg", common.slice(ARGS, 4))
+ dofile(ARGS[3])
+ os.exit(0)
+ end
if ARGS[2] == "download" then
local file = common.get(ARGS[3]);
print(file)
diff --git a/t/run.lua b/t/run.lua
index 8c60b9c..265d2aa 100644
--- a/t/run.lua
+++ b/t/run.lua
@@ -85,10 +85,6 @@ local tests = {
end
}
-
-
-
-
local last_command_result, last_command
lpm = function(cmd)
last_command = "./lpm --quiet --json --userdir=" .. userdir .. " " .. cmd
@@ -121,12 +117,14 @@ local function run_tests(tests, arg)
local failed = false
xpcall(v, function(err)
print("[FAIL]: " .. debug.traceback(err, 2))
- print()
- print()
if last_command then
print("Last Command: " .. last_command)
- print(json.encode(last_command_result))
+ if last_command_result then
+ print(json.encode(last_command_result))
+ end
end
+ print()
+ print()
fail_count = fail_count + 1
failed = true
end)
@@ -137,5 +135,4 @@ local function run_tests(tests, arg)
os.exit(fail_count)
end
-
run_tests(tests, arg)