diff --git a/lib/fbe/pmp.rb b/lib/fbe/pmp.rb index 1c53f73..8a013d9 100644 --- a/lib/fbe/pmp.rb +++ b/lib/fbe/pmp.rb @@ -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) diff --git a/test/fbe/test_pmp.rb b/test/fbe/test_pmp.rb index 66ed640..490955a 100644 --- a/test/fbe/test_pmp.rb +++ b/test/fbe/test_pmp.rb @@ -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 + + + +

+ stealth + true + bool + Test boolean default +

+ +
+ 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 = {}