Skip to content

Commit e305521

Browse files
committed
Fix cache tests for Windows
1 parent 55b31bf commit e305521

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Diff for: spec/cache_spec.lua

+5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ describe("cache", function()
8888

8989
before_each(function()
9090
tmpname = os.tmpname()
91+
92+
-- Work around os.tmpname being broken on Windows sometimes.
93+
if utils.is_windows and not tmpname:find(':') then
94+
tmpname = os.getenv("TEMP") .. tmpname
95+
end
9196
end)
9297

9398
after_each(function()

Diff for: spec/cli_spec.lua

+6-1
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,11 @@ Total: 26 warnings / 0 errors in 1 file
693693

694694
before_each(function()
695695
tmpname = os.tmpname()
696+
697+
-- Work around os.tmpname being broken on Windows sometimes.
698+
if utils.is_windows and not tmpname:find(':') then
699+
tmpname = os.getenv("TEMP") .. tmpname
700+
end
696701
end)
697702

698703
after_each(function()
@@ -777,7 +782,7 @@ return {{"011",%[3%]=1,%[4%]=6,%[5%]=15,%[23%]="expected '=' near '__future__'"}
777782
assert.equal(normal_output, get_output("spec/samples/good_code.lua spec/samples/bad_code.lua spec/samples/python_code.lua --std=lua52 --no-config --cache "..tmpname))
778783

779784
local function write_new_cache(version)
780-
local fh = io.open(tmpname, "w")
785+
local fh = io.open(tmpname, "wb")
781786
assert.userdata(fh)
782787
fh:write(([[
783788
%s

0 commit comments

Comments
 (0)