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-07-01 00:44:40 +0400
committerJason Perkins <starkos@industriousone.com>2011-07-01 00:44:40 +0400
commite87f4851c3841159dc4d02d1703da5df55839261 (patch)
tree6c26d95563ec7141eeb78d06c3bc1da01a360f6e /tests
parent0a683574279419d69724590be7e2630ee7fa9e2b (diff)
Lost a commit somewhere; catching up with my local repository
Diffstat (limited to 'tests')
-rw-r--r--tests/premake4.lua1
-rw-r--r--tests/project/test_eachfile.lua47
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/premake4.lua b/tests/premake4.lua
index 071ebdd..96ca4fa 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -58,6 +58,7 @@
-- Project API tests
dofile("test_project.lua")
+ dofile("project/test_eachfile.lua")
dofile("project/test_vpaths.lua")
-- Baking tests
diff --git a/tests/project/test_eachfile.lua b/tests/project/test_eachfile.lua
new file mode 100644
index 0000000..c7bc3e5
--- /dev/null
+++ b/tests/project/test_eachfile.lua
@@ -0,0 +1,47 @@
+--
+-- tests/project/test_eachfile.lua
+-- Automated test suite for the file iteration function.
+-- Copyright (c) 2011 Jason Perkins and the Premake project
+--
+
+ T.project_eachfile = { }
+ local suite = T.project_eachfile
+ local project = premake.project
+
+
+--
+-- Setup and teardown
+--
+
+ local sln, prj
+ function suite.setup()
+ sln = test.createsolution()
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ end
+
+
+--
+-- Tests
+--
+
+ function suite.ReturnsAllFiles()
+ files { "hello.h", "hello.c" }
+ prepare()
+ local iter = project.eachfile(prj)
+ test.isequal("hello.h", iter().name)
+ test.isequal("hello.c", iter().name)
+ test.isnil(iter())
+ end
+
+
+ function suite.ReturnedObjectIncludesVpath()
+ files { "hello.h", "hello.c" }
+ vpaths { ["*.h"] = "Headers" }
+ prepare()
+ local iter = project.eachfile(prj)
+ test.isequal("Headers/hello.h", iter().vpath)
+ end