Skip to content

Commit

Permalink
Adding tests, and fixing a few typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom van Dijck committed Jun 13, 2017
1 parent d7b6f77 commit 21631dd
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/actions/vstudio/vs2010_rules_xml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
if def.switch then
p.w('Switch="%s"', def.switch)
end
p.w(' />')
p.w('/>')
p.pop()
end

Expand All @@ -173,9 +173,9 @@
p.w('Switch="%s"', switches[key])
end
else
p.w('DisplayName="%s" />', values[key])
p.w('DisplayName="%s"', values[key])
end
p.w(' />')
p.w('/>')
p.pop()
end

Expand All @@ -189,7 +189,7 @@
if def.switch then
p.w('Switch="%s"', def.switch)
end
p.w(' />')
p.w('/>')
p.pop()
end

Expand All @@ -203,7 +203,7 @@
if def.switch then
p.w('Switch="%s"', def.switch)
end
p.w(' />')
p.w('/>')
p.pop()
end

Expand Down
126 changes: 123 additions & 3 deletions tests/actions/vstudio/vc2010/test_rule_xml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 [[
<StringProperty
Name="MyVar"
HelpContext="0"
DisplayName="MyVar"
Switch="[value]"
/>
]]
end

Expand All @@ -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 [[
<BoolProperty
Name="MyVar"
HelpContext="0"
DisplayName="MyVar"
/>
]]
end

function suite.properties_onBoolean()
createVar { name="MyVar", kind="boolean", switch="[value]" }
local r = test.getRule("MyRule")
m.properties(r)
test.capture [[
<BoolProperty
Name="MyVar"
HelpContext="0"
DisplayName="MyVar"
Switch="[value]"
/>
]]
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 [[
<EnumProperty
Name="OptimizationLevel"
HelpContext="0"
DisplayName="Optimization Level">
<EnumValue
Name="0"
DisplayName="None"
Switch="-O0"
/>
<EnumValue
Name="1"
DisplayName="Size"
Switch="-O1"
/>
<EnumValue
Name="2"
DisplayName="Speed"
Switch="-O3"
/>
</EnumProperty>
]]
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 [[
<EnumProperty
Name="OptimizationLevel"
HelpContext="0"
DisplayName="Optimization Level">
<EnumValue
Name="0"
DisplayName="None"
/>
<EnumValue
Name="1"
DisplayName="Size"
/>
<EnumValue
Name="2"
DisplayName="Speed"
/>
</EnumProperty>
]]
end

0 comments on commit 21631dd

Please sign in to comment.