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 - Added support for Apple Xcode 3
-------
4.1.2
-------
- Changed arguments to GCC link step to fix static linking - Changed arguments to GCC link step to fix static linking
- Fixed ManagedExtension setting for Visual Studio - 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 - Use libtool instead of ar for Mac OS X Universal static libraries

View File

@ -39,32 +39,6 @@
end 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. -- Trigger an action.
-- --
@ -94,6 +68,32 @@
end 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. -- 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); m->path = (char*)malloc(split - mask + 1);
strncpy(m->path, mask, split - mask); strncpy(m->path, mask, split - mask);
m->path[split - mask] = '\0'; m->path[split - mask] = '\0';
m->mask = (char*)(split + 1); m->mask = (char*)malloc(mask + strlen(mask) - split);
strcpy(m->mask, split + 1);
} }
else else
{ {
m->path = (char*)malloc(2); m->path = (char*)malloc(2);
strcpy(m->path, "."); strcpy(m->path, ".");
m->mask = (char*)mask; m->mask = (char*)malloc(strlen(mask)+1);
strcpy(m->mask, mask);
} }
m->handle = opendir(m->path); m->handle = opendir(m->path);
@ -126,6 +128,7 @@ int os_matchdone(lua_State* L)
if (m->handle != NULL) if (m->handle != NULL)
closedir(m->handle); closedir(m->handle);
free(m->path); free(m->path);
free(m->mask);
free(m); free(m);
return 0; return 0;
} }

View File

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

View File

@ -1,10 +1,9 @@
-- --
-- tests/test_path.lua -- tests/base/test_path.lua
-- Automated test suite for the path manipulation functions. -- Automated test suite for the action list.
-- Copyright (c) 2008 Jason Perkins and the Premake project -- Copyright (c) 2008,2009 Jason Perkins and the Premake project
-- --
T.path = { } T.path = { }
@ -160,7 +159,17 @@
test.isequal("trailing", path.join(".", "trailing")) test.isequal("trailing", path.join(".", "trailing"))
end 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 -- path.translate() tests
-- --

View File

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