Fixed os.match() for very large result sets; fixed bug in action tests

This commit is contained in:
starkos 2009-09-29 19:27:33 +00:00
parent 18c498f7b3
commit 1f0e3ed568
6 changed files with 55 additions and 35 deletions

View File

@ -3,12 +3,18 @@
-----
- Added support for Apple Xcode 3
-------
4.1.2
-------
- Changed arguments to GCC link step to fix static linking
- Fixed ManagedExtension setting for Visual Studio
-------
4.1.1 (in progress)
4.1.1
-------
- Use libtool instead of ar for Mac OS X Universal static libraries

View File

@ -39,32 +39,6 @@
end
--
-- Retrieve the current action, as determined by _ACTION.
--
-- @return
-- The current action, or nil if _ACTION is nil or does not match any action.
--
function premake.action.current()
return premake.action.get(_ACTION)
end
--
-- Retrieve an action by name.
--
-- @param name
-- The name of the action to retrieve.
-- @returns
-- The requested action, or nil if the action does not exist.
--
function premake.action.get(name)
return premake.action.list[name]
end
--
-- Trigger an action.
--
@ -94,6 +68,32 @@
end
--
-- Retrieve the current action, as determined by _ACTION.
--
-- @return
-- The current action, or nil if _ACTION is nil or does not match any action.
--
function premake.action.current()
return premake.action.get(_ACTION)
end
--
-- Retrieve an action by name.
--
-- @param name
-- The name of the action to retrieve.
-- @returns
-- The requested action, or nil if the action does not exist.
--
function premake.action.get(name)
return premake.action.list[name]
end
--
-- Iterator for the list of actions.
--

View File

@ -106,13 +106,15 @@ int os_matchstart(lua_State* L)
m->path = (char*)malloc(split - mask + 1);
strncpy(m->path, mask, split - mask);
m->path[split - mask] = '\0';
m->mask = (char*)(split + 1);
m->mask = (char*)malloc(mask + strlen(mask) - split);
strcpy(m->mask, split + 1);
}
else
{
m->path = (char*)malloc(2);
strcpy(m->path, ".");
m->mask = (char*)mask;
m->mask = (char*)malloc(strlen(mask)+1);
strcpy(m->mask, mask);
}
m->handle = opendir(m->path);
@ -126,6 +128,7 @@ int os_matchdone(lua_State* L)
if (m->handle != NULL)
closedir(m->handle);
free(m->path);
free(m->mask);
free(m);
return 0;
}

View File

@ -65,7 +65,9 @@
--
function T.action.set_SetsActionOS()
local oldos = _OS
_OS = "linux"
premake.action.set("vs2008")
test.isequal(_OS, "windows")
_OS = oldos
end

View File

@ -1,10 +1,9 @@
--
-- tests/test_path.lua
-- Automated test suite for the path manipulation functions.
-- Copyright (c) 2008 Jason Perkins and the Premake project
-- tests/base/test_path.lua
-- Automated test suite for the action list.
-- Copyright (c) 2008,2009 Jason Perkins and the Premake project
--
T.path = { }
@ -160,7 +159,17 @@
test.isequal("trailing", path.join(".", "trailing"))
end
--
-- path.rebase() tests
--
function T.path.rebase_WithEndingSlashOnPath()
local cwd = os.getcwd()
test.isequal("src", path.rebase("../src/", cwd, path.getdirectory(cwd)))
end
--
-- path.translate() tests
--

View File

@ -39,7 +39,6 @@
dofile("test_dofile.lua")
dofile("test_os.lua")
dofile("test_path.lua")
dofile("test_string.lua")
dofile("test_table.lua")
dofile("test_premake.lua")
@ -58,6 +57,7 @@
dofile("test_gmake_cpp.lua")
dofile("test_gmake_cs.lua")
dofile("base/test_action.lua")
dofile("base/test_path.lua")
dofile("base/test_tree.lua")
dofile("actions/test_clean.lua")
dofile("actions/test_xcode.lua")