diff --git a/src/actions/vstudio/vs2010_rules_xml.lua b/src/actions/vstudio/vs2010_rules_xml.lua
index b5a56f7b92..372367f66c 100644
--- a/src/actions/vstudio/vs2010_rules_xml.lua
+++ b/src/actions/vstudio/vs2010_rules_xml.lua
@@ -146,7 +146,10 @@
function m.boolProperty(def)
p.push('', def.switch or "[value]")
+ if def.switch then
+ p.w('Switch="%s"', def.switch)
+ end
+ p.w('/>')
p.pop()
end
@@ -166,10 +169,13 @@
p.w('Name="%d"', key)
if switches[key] then
p.w('DisplayName="%s"', values[key])
- p.w('Switch="%s" />', switches[key])
+ if switches[key] then
+ p.w('Switch="%s"', switches[key])
+ end
else
- p.w('DisplayName="%s" />', values[key])
+ p.w('DisplayName="%s"', values[key])
end
+ p.w('/>')
p.pop()
end
@@ -180,7 +186,10 @@
function m.stringProperty(def)
p.push('', def.switch or "[value]")
+ if def.switch then
+ p.w('Switch="%s"', def.switch)
+ end
+ p.w('/>')
p.pop()
end
@@ -188,8 +197,13 @@
function m.stringListProperty(def)
p.push('', def.switch or "[value]")
+ if def.separator then
+ p.w('Separator="%s"', def.separator)
+ end
+ if def.switch then
+ p.w('Switch="%s"', def.switch)
+ end
+ p.w('/>')
p.pop()
end
diff --git a/tests/actions/vstudio/vc2010/test_rule_xml.lua b/tests/actions/vstudio/vc2010/test_rule_xml.lua
index a47bb77f3f..a18fb07b49 100644
--- a/tests/actions/vstudio/vc2010/test_rule_xml.lua
+++ b/tests/actions/vstudio/vc2010/test_rule_xml.lua
@@ -34,7 +34,7 @@
-- Property definitions
---
- function suite.properties_onString()
+ function suite.properties_onStringNoSwitch()
createVar { name="MyVar", kind="string" }
local r = test.getRule("MyRule")
m.properties(r)
@@ -43,7 +43,21 @@
Name="MyVar"
HelpContext="0"
DisplayName="MyVar"
- Switch="[value]" />
+ />
+ ]]
+ end
+
+ function suite.properties_onString()
+ createVar { name="MyVar", kind="string", switch="[value]" }
+ local r = test.getRule("MyRule")
+ m.properties(r)
+ test.capture [[
+
]]
end
@@ -56,6 +70,112 @@
Name="MyVar"
HelpContext="0"
DisplayName="MyVar"
- Switch="[value]" />
+ />
+ ]]
+ end
+
+
+ function suite.properties_onBooleanNoSwitch()
+ createVar { name="MyVar", kind="boolean" }
+ local r = test.getRule("MyRule")
+ m.properties(r)
+ test.capture [[
+
+ ]]
+ end
+
+ function suite.properties_onBoolean()
+ createVar { name="MyVar", kind="boolean", switch="[value]" }
+ local r = test.getRule("MyRule")
+ m.properties(r)
+ test.capture [[
+
+ ]]
+ end
+
+ function suite.properties_onEnum()
+ createVar {
+ name = "OptimizationLevel",
+ display = "Optimization Level",
+ values = {
+ [0] = "None",
+ [1] = "Size",
+ [2] = "Speed",
+ },
+ switch = {
+ [0] = "-O0",
+ [1] = "-O1",
+ [2] = "-O3",
+ },
+ value = 2,
+ }
+
+ local r = test.getRule("MyRule")
+ m.properties(r)
+ test.capture [[
+
+
+
+
+
+ ]]
+ end
+
+ function suite.properties_onEnumNoSwitches()
+ createVar {
+ name = "OptimizationLevel",
+ display = "Optimization Level",
+ values = {
+ [0] = "None",
+ [1] = "Size",
+ [2] = "Speed",
+ },
+ value = 2,
+ }
+
+ local r = test.getRule("MyRule")
+ m.properties(r)
+ test.capture [[
+
+
+
+
+
]]
end