Skip to content

Commit 32cba9e

Browse files
author
Beernaert Robbe
committed
fixed thr broken global.json test
1 parent e17721f commit 32cba9e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

modules/vstudio/tests/cs2005/test_dotnetsdk.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@
132132
local cfg = test.getconfig(prj, "Debug")
133133
prj.dotnetsdk = "MSTest"
134134
dn2005.output_global_json(prj)
135-
test.capture[[
136-
{
137-
"msbuild-sdks":
138-
{
139-
"MSTest.Sdk": "3.6.1"
140-
}
141-
}
142-
]]
135+
test.capture[[{"msbuild-sdks":{"MSTest.Sdk": "3.6.1"}}]]
136+
end
137+
138+
function suite.testMSTestGlobalJSONExists()
139+
prepare()
140+
local cfg = test.getconfig(prj, "Debug")
141+
prj.dotnetsdk = "MSTest"
142+
p.generate(prj, path.join(prj.workspace.location, "global.json"), function() p.outln('{"test":"global"') end)
143+
dn2005.output_global_json(prj)
144+
test.capture[[{"test":"global","msbuild-sdks":{"MSTest.Sdk": "3.6.1"}}]]
143145
end

modules/vstudio/vs2005_dotnetbase.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,10 @@
846846

847847
function dotnetbase.output_global_json(prj)
848848
if prj.dotnetsdk == "MSTest" then
849-
globaljson = json.decode(io.readfile(path.join(prj.workspace.location, "global.json")))
850-
globaljson = globaljson or {}
849+
local globaljson = json.decode(io.readfile(path.join(prj.workspace.location, "global.json"))) or {}
851850
globaljson["msbuild-sdks"] = globaljson["msbuild-sdks"] or {}
852851
globaljson["msbuild-sdks"]["MSTest.Sdk"] = "3.6.1"
852+
853853
_p(json.encode(globaljson))
854854
end
855855
end

0 commit comments

Comments
 (0)