Skip to content

Commit

Permalink
wip v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kevans91 committed Sep 24, 2024
1 parent d571376 commit 58f757c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 60 deletions.
3 changes: 3 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ file(GLOB lua_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/porch/*.lua")

add_custom_target(libs
DEPENDS core)

add_custom_target(lint
COMMAND echo LINTING FOR LUA 5.3
COMMAND luacheck --std=lua53 ${lua_SOURCES}
Expand Down
15 changes: 12 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
add_custom_target(check
COMMAND true # env PORCHBIN="${CMAKE_BINARY_DIR}/src/porch" PORCHLUA_PATH="${CMAKE_SOURCE_DIR}/lib" sh "${CMAKE_CURRENT_SOURCE_DIR}/basic_test.sh"
COMMAND env PORCHLIB_PATH="${CMAKE_BINARY_DIR}/lib" PORCHLUA_PATH="${CMAKE_SOURCE_DIR}/lib" sh "${CMAKE_CURRENT_SOURCE_DIR}/lua_test.sh"
add_custom_target(check-install
COMMAND "${CMAKE_COMMAND}" --build . --target install)

add_custom_target(check-cli
COMMAND env PORCHBIN="${CMAKE_BINARY_DIR}/src/porch" PORCHLUA_PATH="${CMAKE_SOURCE_DIR}/lib" sh "${CMAKE_CURRENT_SOURCE_DIR}/basic_test.sh"
DEPENDS porch)

add_custom_target(check-lib
COMMAND env PORCHLIB_PATH="${CMAKE_BINARY_DIR}/lib" PORCHLUA_PATH="${CMAKE_SOURCE_DIR}/lib" LUA_VERSION_MAJOR="${LUA_VERSION_MAJOR}" LUA_VERSION_MINOR="${LUA_VERSION_MINOR}" sh "${CMAKE_CURRENT_SOURCE_DIR}/lua_test.sh"
DEPENDS libs check-install
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")

add_custom_target(check DEPENDS check-cli check-lib)
53 changes: 0 additions & 53 deletions tests/libtest.lua

This file was deleted.

17 changes: 16 additions & 1 deletion tests/lua_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#!/bin/sh

schemes="lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR}"
schemes="$schemes lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}"

for bin in $schemes; do
if command -v $bin >/dev/null; then
LUA="$bin"
break
fi
done

if [ -z "$LUA" ]; then
1>&2 "Could not find suitable binary named any of: $schemes"
exit 1
fi

for x in test_*.lua; do #XXX WRONG
lua54 "$x" #XXX WRONG
command $LUA "$x"
done
4 changes: 1 addition & 3 deletions tests/test_basic.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local ltest = require('./libtest')

local porch = require('porch')


print(porch)

0 comments on commit 58f757c

Please sign in to comment.