summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/genie/tests/test_dofile.lua
blob: 4aaf4035ea831e0eefc6a079cd534b47554d6cab (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
--
-- tests/test_dofile.lua
-- Automated test suite for the extended dofile() functions.
-- Copyright (c) 2008 Jason Perkins and the Premake project
--


	T.dofile = { }

	
	local os_getenv
	
	function T.dofile.setup()
		os_getenv = os.getenv
	end
	
	function T.dofile.teardown()
		os.getenv = os_getenv
	end
	
	
--
-- dofile() tests
--

	function T.dofile.SearchesPath()
		os.getenv = function() return os.getcwd().."/folder" end
		result = dofile("ok.lua")
		test.isequal("ok", result)
	end

	function T.dofile.SearchesScriptsOption()
		_OPTIONS["scripts"] = os.getcwd().."/folder"
		result = dofile("ok.lua")
		test.isequal("ok", result)
	end