File: test_dofile.lua

package info (click to toggle)
premake4 4.3%2Brepack1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,852 kB
  • sloc: ansic: 636; makefile: 57; sh: 2
file content (36 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (16)
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