summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/genie/tests/project/test_eachfile.lua
blob: 8ddf235dcd22c5678a9a57e611349a3974dbd98b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--
-- 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" }
		prepare()
		local iter = project.eachfile(prj)
		test.isequal("hello.h", iter().vpath)
	end