Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fbe/pmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def initialize(value, default, type, memo)
case type
when 'int' then Integer(Float(result).truncate)
when 'float' then Float(result)
when 'bool' then result == 'true'
when 'bool' then result.to_s == 'true'
else result
end
pmpv.new(result, default, type, memo)
Expand Down
24 changes: 24 additions & 0 deletions test/fbe/test_pmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ def test_some_defaults
refute(Fbe.pmp(loog: Loog::NULL).communications.stealth)
end

def test_reads_true_boolean_default
$fb = Factbase.new
$global = {}
$options = Judges::Options.new
$loog = Loog::NULL
xml = <<~XML
<?xml version='1.0'?>
<pmp>
<area name="communications">
<p>
<name>stealth</name>
<default>true</default>
<type>bool</type>
<memo>Test boolean default</memo>
</p>
</area>
</pmp>
XML
File.stub(:read, xml) do
assert(Fbe.pmp(loog: Loog::NULL).communications.stealth)
assert(Fbe.pmp(loog: Loog::NULL).communications.stealth.value)
end
end

def test_converts_to_correct_type
$fb = Factbase.new
$global = {}
Expand Down
Loading