Skip to content

Commit 466b610

Browse files
committed
Simplify directory handling in test_sources.lua.
1 parent c9d2c47 commit 466b610

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tests/project/test_sources.lua

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@
1515

1616
local wks, prj
1717

18-
local cwd = os.getcwd()
19-
local oldcwd
20-
2118
function suite.setup()
2219
wks, prj = test.createWorkspace()
2320

2421
-- We change the directory to get nice relative paths
25-
oldcwd = os.getcwd()
26-
os.chdir(cwd)
22+
os.chdir(_SCRIPT_DIR)
2723

2824
-- Create a token to be used in search paths
2925
p.api.register { name = "mytoken", kind = "string", scope = "config" }
@@ -32,15 +28,14 @@
3228

3329
function suite.teardown()
3430
mytoken = nil
35-
os.chdir(oldcwd)
3631
end
3732

3833
local function run()
3934
local cfg = test.getconfig(prj, "Debug")
4035

4136
local files = {}
4237
for _, file in ipairs(cfg.files) do
43-
table.insert(files, path.getrelative(cwd, file))
38+
table.insert(files, path.getrelative(os.getcwd(), file))
4439
end
4540

4641
return files

0 commit comments

Comments
 (0)