Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2011-02-10 20:24:51 +0300
committerJason Perkins <starkos@industriousone.com>2011-02-10 20:24:51 +0300
commit553185ac9c70b984af9049f32ea520f5f7458bd8 (patch)
treef64537fd006d8d4b61f1fbc9f855b6c3de7246e5 /tests
parent914deb2e13ad0d08ad924f462a6c11c4ae28ed29 (diff)
Added support for Haiku OS (Yuriy O'Donnell)
Diffstat (limited to 'tests')
-rw-r--r--tests/base/test_os.lua247
-rw-r--r--tests/premake4.lua4
-rw-r--r--tests/tools/test_gcc.lua (renamed from tests/test_gcc.lua)42
3 files changed, 162 insertions, 131 deletions
diff --git a/tests/base/test_os.lua b/tests/base/test_os.lua
index 9bcd230..fb720c9 100644
--- a/tests/base/test_os.lua
+++ b/tests/base/test_os.lua
@@ -1,121 +1,126 @@
---
--- tests/base/test_os.lua
--- Automated test suite for the new OS functions.
--- Copyright (c) 2008-2010 Jason Perkins and the Premake project
---
-
-
- T.os = { }
- local suite = T.os
-
-
---
--- os.findlib() tests
---
-
- function suite.findlib_FindSystemLib()
- local libname = iif(os.is("windows"), "user32", "m")
- test.istrue(os.findlib(libname))
- end
-
- function suite.findlib_FailsOnBadLibName()
- test.isfalse(os.findlib("NoSuchLibraryAsThisOneHere"))
- end
-
-
---
--- os.isfile() tests
---
-
- function suite.isfile_ReturnsTrue_OnExistingFile()
- test.istrue(os.isfile("premake4.lua"))
- end
-
- function suite.isfile_ReturnsFalse_OnNonexistantFile()
- test.isfalse(os.isfile("no_such_file.lua"))
- end
-
-
-
---
--- os.matchfiles() tests
---
-
- function suite.matchfiles_OnNonRecursive()
- local result = os.matchfiles("*.lua")
- test.istrue(table.contains(result, "testfx.lua"))
- test.isfalse(table.contains(result, "folder/ok.lua"))
- end
-
- function suite.matchfiles_Recursive()
- local result = os.matchfiles("**.lua")
- test.istrue(table.contains(result, "folder/ok.lua"))
- end
-
- function suite.matchfiles_SkipsDotDirs_OnRecursive()
- local result = os.matchfiles("**.lua")
- test.isfalse(table.contains(result, ".svn/text-base/testfx.lua.svn-base"))
- end
-
- function suite.matchfiles_OnSubfolderMatch()
- local result = os.matchfiles("**/xcode/*")
- test.istrue(table.contains(result, "actions/xcode/test_xcode_project.lua"))
- test.isfalse(table.contains(result, "premake4.lua"))
- end
-
- function suite.matchfiles_OnDotSlashPrefix()
- local result = os.matchfiles("./**.lua")
- test.istrue(table.contains(result, "folder/ok.lua"))
- end
-
- function suite.matchfiles_OnImplicitEndOfString()
- local result = os.matchfiles("folder/*.lua")
- test.istrue(table.contains(result, "folder/ok.lua"))
- test.isfalse(table.contains(result, "folder/ok.lua.2"))
- end
-
- function suite.matchfiles_OnLeadingDotSlashWithPath()
- local result = os.matchfiles("./folder/*.lua")
- test.istrue(table.contains(result, "folder/ok.lua"))
- end
-
-
-
---
--- os.pathsearch() tests
---
-
- function suite.pathsearch_ReturnsNil_OnNotFound()
- test.istrue( os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil )
- end
-
- function suite.pathsearch_ReturnsPath_OnFound()
- test.isequal(os.getcwd(), os.pathsearch("premake4.lua", os.getcwd()))
- end
-
- function suite.pathsearch_FindsFile_OnComplexPath()
- test.isequal(os.getcwd(), os.pathsearch("premake4.lua", "aaa;"..os.getcwd()..";bbb"))
- end
-
- function suite.pathsearch_NilPathsAllowed()
- test.isequal(os.getcwd(), os.pathsearch("premake4.lua", nil, os.getcwd(), nil))
- end
-
-
---
--- os.uuid() tests
---
-
- function suite.guid_ReturnsValidUUID()
- local g = os.uuid()
- test.istrue(#g == 36)
- for i=1,36 do
- local ch = g:sub(i,i)
- test.istrue(ch:find("[ABCDEF0123456789-]"))
- end
- test.isequal("-", g:sub(9,9))
- test.isequal("-", g:sub(14,14))
- test.isequal("-", g:sub(19,19))
- test.isequal("-", g:sub(24,24))
- end
-
+--
+-- tests/base/test_os.lua
+-- Automated test suite for the new OS functions.
+-- Copyright (c) 2008-2011 Jason Perkins and the Premake project
+--
+
+
+ T.os = { }
+ local suite = T.os
+
+
+--
+-- os.findlib() tests
+--
+
+ function suite.findlib_FindSystemLib()
+ if os.is("windows") then
+ test.istrue(os.findlib("user32"))
+ elseif os.is("haiku") then
+ test.istrue(os.findlib("root"))
+ else
+ test.istrue(os.findlib("m"))
+ end
+ end
+
+ function suite.findlib_FailsOnBadLibName()
+ test.isfalse(os.findlib("NoSuchLibraryAsThisOneHere"))
+ end
+
+
+--
+-- os.isfile() tests
+--
+
+ function suite.isfile_ReturnsTrue_OnExistingFile()
+ test.istrue(os.isfile("premake4.lua"))
+ end
+
+ function suite.isfile_ReturnsFalse_OnNonexistantFile()
+ test.isfalse(os.isfile("no_such_file.lua"))
+ end
+
+
+
+--
+-- os.matchfiles() tests
+--
+
+ function suite.matchfiles_OnNonRecursive()
+ local result = os.matchfiles("*.lua")
+ test.istrue(table.contains(result, "testfx.lua"))
+ test.isfalse(table.contains(result, "folder/ok.lua"))
+ end
+
+ function suite.matchfiles_Recursive()
+ local result = os.matchfiles("**.lua")
+ test.istrue(table.contains(result, "folder/ok.lua"))
+ end
+
+ function suite.matchfiles_SkipsDotDirs_OnRecursive()
+ local result = os.matchfiles("**.lua")
+ test.isfalse(table.contains(result, ".svn/text-base/testfx.lua.svn-base"))
+ end
+
+ function suite.matchfiles_OnSubfolderMatch()
+ local result = os.matchfiles("**/xcode/*")
+ test.istrue(table.contains(result, "actions/xcode/test_xcode_project.lua"))
+ test.isfalse(table.contains(result, "premake4.lua"))
+ end
+
+ function suite.matchfiles_OnDotSlashPrefix()
+ local result = os.matchfiles("./**.lua")
+ test.istrue(table.contains(result, "folder/ok.lua"))
+ end
+
+ function suite.matchfiles_OnImplicitEndOfString()
+ local result = os.matchfiles("folder/*.lua")
+ test.istrue(table.contains(result, "folder/ok.lua"))
+ test.isfalse(table.contains(result, "folder/ok.lua.2"))
+ end
+
+ function suite.matchfiles_OnLeadingDotSlashWithPath()
+ local result = os.matchfiles("./folder/*.lua")
+ test.istrue(table.contains(result, "folder/ok.lua"))
+ end
+
+
+
+--
+-- os.pathsearch() tests
+--
+
+ function suite.pathsearch_ReturnsNil_OnNotFound()
+ test.istrue( os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil )
+ end
+
+ function suite.pathsearch_ReturnsPath_OnFound()
+ test.isequal(os.getcwd(), os.pathsearch("premake4.lua", os.getcwd()))
+ end
+
+ function suite.pathsearch_FindsFile_OnComplexPath()
+ test.isequal(os.getcwd(), os.pathsearch("premake4.lua", "aaa;"..os.getcwd()..";bbb"))
+ end
+
+ function suite.pathsearch_NilPathsAllowed()
+ test.isequal(os.getcwd(), os.pathsearch("premake4.lua", nil, os.getcwd(), nil))
+ end
+
+
+--
+-- os.uuid() tests
+--
+
+ function suite.guid_ReturnsValidUUID()
+ local g = os.uuid()
+ test.istrue(#g == 36)
+ for i=1,36 do
+ local ch = g:sub(i,i)
+ test.istrue(ch:find("[ABCDEF0123456789-]"))
+ end
+ test.isequal("-", g:sub(9,9))
+ test.isequal("-", g:sub(14,14))
+ test.isequal("-", g:sub(19,19))
+ test.isequal("-", g:sub(24,24))
+ end
+
diff --git a/tests/premake4.lua b/tests/premake4.lua
index 51d9691..48dd459 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -1,7 +1,7 @@
--
-- tests/premake4.lua
-- Automated test suite for Premake 4.x
--- Copyright (c) 2008-2010 Jason Perkins and the Premake project
+-- Copyright (c) 2008-2011 Jason Perkins and the Premake project
--
dofile("testfx.lua")
@@ -44,7 +44,6 @@
dofile("test_platforms.lua")
dofile("test_targets.lua")
dofile("test_keywords.lua")
- dofile("test_gcc.lua")
dofile("test_gmake_cpp.lua")
dofile("test_gmake_cs.lua")
dofile("base/test_api.lua")
@@ -55,6 +54,7 @@
dofile("base/test_path.lua")
dofile("base/test_table.lua")
dofile("base/test_tree.lua")
+ dofile("tools/test_gcc.lua")
-- Clean tests
dofile("actions/test_clean.lua")
diff --git a/tests/test_gcc.lua b/tests/tools/test_gcc.lua
index 9334ef3..c7fed84 100644
--- a/tests/test_gcc.lua
+++ b/tests/tools/test_gcc.lua
@@ -1,7 +1,7 @@
--
-- tests/test_gcc.lua
-- Automated test suite for the GCC toolset interface.
--- Copyright (c) 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
T.gcc = { }
@@ -23,19 +23,33 @@
end
- function suite.cflags_SharedLib_Windows()
- cfg.kind = "SharedLib"
+--
+-- CPPFLAGS tests
+--
+
+ function suite.cppflags_OnWindows()
cfg.system = "windows"
- local r = premake.gcc.getcflags(cfg)
- test.isequal('', table.concat(r,"|"))
+ local r = premake.gcc.getcppflags(cfg)
+ test.isequal("-MMD -MP", table.concat(r, " "))
end
+ function suite.cppflags_OnHaiku()
+ cfg.system = "haiku"
+ local r = premake.gcc.getcppflags(cfg)
+ test.isequal("-MMD", table.concat(r, " "))
+ end
- function suite.ldflags_SharedLib_Windows()
+
+
+--
+-- CFLAGS tests
+--
+
+ function suite.cflags_SharedLib_Windows()
cfg.kind = "SharedLib"
cfg.system = "windows"
- local r = premake.gcc.getldflags(cfg)
- test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
+ local r = premake.gcc.getcflags(cfg)
+ test.isequal('', table.concat(r,"|"))
end
@@ -53,6 +67,18 @@
end
+--
+-- LDFLAGS tests
+--
+
+ function suite.ldflags_SharedLib_Windows()
+ cfg.kind = "SharedLib"
+ cfg.system = "windows"
+ local r = premake.gcc.getldflags(cfg)
+ test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
+ end
+
+
function suite.linkflags_OnFrameworks()
cfg.links = { "Cocoa.framework" }
local r = premake.gcc.getlinkflags(cfg)