diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-01-13 14:47:00 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-01-13 14:47:00 -0500 |
commit | 17ce7c5ee47b4febde65d571993d4c963d85fcc1 (patch) | |
tree | 789075caebcd656fd8ec96fad818e861114abd67 | |
parent | 9424e382ece5181f00f70f79219e3248a468eeaa (diff) | |
download | lite-xl-plugin-manager-17ce7c5ee47b4febde65d571993d4c963d85fcc1.tar.gz lite-xl-plugin-manager-17ce7c5ee47b4febde65d571993d4c963d85fcc1.zip |
Updated it so that lpm can run tests.
-rw-r--r-- | .github/workflows/build.yml | 2 | ||||
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | src/lpm.lua | 7 | ||||
-rw-r--r-- | t/run.lua | 13 |
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: | @@ -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) @@ -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) |