From f50f9d58ef5fe86363e5223b2b55075f6c4c636c Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 5 Mar 2024 21:38:15 -0300 Subject: fix(windows): parse slashes correctly when reading rock_manifest --- spec/quick/build.q | 47 +++++++++++++++++++++++++++++++++++++++++++++++ spec/util/test_env.lua | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/quick/build.q b/spec/quick/build.q index 958ce5d1..6d7c4744 100644 --- a/spec/quick/build.q +++ b/spec/quick/build.q @@ -302,3 +302,50 @@ return { } } -------------------------------------------------------------------------------- + + + +================================================================================ +TEST: installs bin entries correctly + +FILE: test-1.0-1.rockspec +-------------------------------------------------------------------------------- +package = "test" +version = "1.0-1" +source = { + url = "file://%{url(%{fixtures_dir})}/an_upstream_tarball-0.1.tar.gz", + dir = "an_upstream_tarball-0.1", +} +build = { + type = "builtin", + modules = { + my_module = "src/my_module.lua" + }, + install = { + bin = { + "src/my_module.lua" + } + } +} +-------------------------------------------------------------------------------- + +RUN: luarocks build test-1.0-1.rockspec --tree=lua_modules + +RM: %{fixtures_dir}/bin/something.lua + +EXISTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/test-1.0-1.rockspec + +FILE_CONTENTS: ./lua_modules/lib/luarocks/rocks-%{lua_version}/test/1.0-1/rock_manifest +-------------------------------------------------------------------------------- +rock_manifest = { + bin = { + ["my_module.lua"] = "25884dbf5be7114791018a48199d4c04" + }, + lua = { + ["my_module.lua"] = "25884dbf5be7114791018a48199d4c04" + }, + ["test-1.0-1.rockspec"] = +} +-------------------------------------------------------------------------------- + +EXISTS: ./lua_modules/bin/my_module.lua%{wrapper_extension} diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 2255d141..5d385db3 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -527,7 +527,7 @@ end function test_env.write_file(pathname, str, finally) pathname = V(pathname) - local file = assert(io.open(pathname, "w")) + local file = assert(io.open(pathname, "wb")) file:write(str) file:close() if finally then -- cgit v1.2.3-55-g6feb