mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
lua.tests.checkSetupHook: test lua setup hook for http package
the 'http' package is an interesting one to test because all its lua files are in a 'http' subfolder, ie., there is no share/lua/5.1/*.lua, only share/lua/5.1/http/*.lua files unlike most packages. This tests we can match those subfolders.
This commit is contained in:
parent
cb1f3bcd8b
commit
b8be016426
@ -25,6 +25,7 @@ addToLuaSearchPathWithCustomDelimiter() {
|
||||
# export only if the folder contains lua files
|
||||
shopt -s globstar
|
||||
|
||||
|
||||
for _file in ${absPattern/\?/\*\*}; do
|
||||
export "${varName}=${!varName:+${!varName};}${absPattern}"
|
||||
shopt -u globstar
|
||||
|
@ -66,6 +66,21 @@ in
|
||||
touch $out
|
||||
'');
|
||||
|
||||
# checks that lua's setup-hook adds dependencies to LUA_PATH
|
||||
# Prevents the following regressions
|
||||
# $ env NIX_PATH=nixpkgs=. nix-shell --pure -Q -p luajitPackages.lua luajitPackages.http
|
||||
# nix-shell$ luajit
|
||||
# > require('http.request')
|
||||
# stdin:1: module 'http.request' not found:
|
||||
checkSetupHook = pkgs.runCommandLocal "test-${lua.name}-setup-hook" ({
|
||||
nativeBuildInputs = [lua];
|
||||
buildInputs = [ lua.pkgs.http ];
|
||||
meta.platforms = lua.meta.platforms;
|
||||
}) (''
|
||||
${lua}/bin/lua -e "require'http.request'"
|
||||
touch $out
|
||||
'');
|
||||
|
||||
checkRelativeImports = pkgs.runCommandLocal "test-${lua.name}-relative-imports" ({
|
||||
}) (''
|
||||
source ${./assert.sh}
|
||||
|
Loading…
Reference in New Issue
Block a user