From b85f0855194d6fad4c307eccf48d41e6963f71b1 Mon Sep 17 00:00:00 2001 From: GHX5T-SOL <200635707+GHX5T-SOL@users.noreply.github.com> Date: Mon, 25 May 2026 19:12:55 +0200 Subject: [PATCH] #481: preserve true bool PMP defaults --- lib/fbe/pmp.rb | 2 +- test/fbe/test_pmp.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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 = {}