metanorma / pubid-ieee

PubID spec and implementation for IEEE deliverables
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

"invalid value for Integer()" error when rendering month in ruby 3.2 #104

Closed mico closed 12 months ago

mico commented 1 year ago
Failures:

  1) Pubid::Ieee::Identifier parse specific identifiers IEC/IEEE 60076-16 Edition 2.0 2018-09 behaves like converts pubid to pubid converts pubid to pubid
     Failure/Error: result += "-#{sprintf('%02d', month)}"

     ArgumentError:
       invalid value for Integer(): "09"
     Shared Example Group: "converts pubid to pubid" called from ./spec/pubid_ieee/identifiers_parsing_spec.rb:111
     # ./lib/pubid/ieee/identifier/base.rb:203:in `sprintf'
     # ./lib/pubid/ieee/identifier/base.rb:203:in `edition'
     # ./lib/pubid/ieee/identifier/base.rb:133:in `parameters'
     # ./lib/pubid/ieee/identifier/base.rb:120:in `dual_identifier'
     # ./lib/pubid/ieee/identifier/base.rb:105:in `to_s'
     # ./spec/pubid_ieee/identifiers_parsing_spec.rb:17:in `block (3 levels) in <module:Ieee>'

  2) Pubid::Ieee::Identifier parse specific identifiers IEC 61523-3 First edition 2004-09 behaves like converts pubid to pubid converts pubid to pubid
     Failure/Error: result += "-#{sprintf('%02d', month)}"

     ArgumentError:
       invalid value for Integer(): "09"
     Shared Example Group: "converts pubid to pubid" called from ./spec/pubid_ieee/identifiers_parsing_spec.rb:146
     # ./lib/pubid/ieee/identifier/base.rb:203:in `sprintf'
     # ./lib/pubid/ieee/identifier/base.rb:203:in `edition'
     # ./lib/pubid/ieee/identifier/base.rb:133:in `parameters'
     # ./lib/pubid/ieee/identifier/base.rb:120:in `dual_identifier'
     # ./lib/pubid/ieee/identifier/base.rb:105:in `to_s'
     # ./spec/pubid_ieee/identifiers_parsing_spec.rb:17:in `block (3 levels) in <module:Ieee>'

  3) Pubid::Ieee::Identifier parse specific identifiers IEC/IEEE 62582-1:2011 Edition 1.0 2011-08 behaves like converts pubid to pubid converts pubid to pubid
     Failure/Error: result += "-#{sprintf('%02d', month)}"

     ArgumentError:
       invalid value for Integer(): "08"
     Shared Example Group: "converts pubid to pubid" called from ./spec/pubid_ieee/identifiers_parsing_spec.rb:697
     # ./lib/pubid/ieee/identifier/base.rb:203:in `sprintf'
     # ./lib/pubid/ieee/identifier/base.rb:203:in `edition'
     # ./lib/pubid/ieee/identifier/base.rb:133:in `parameters'
     # ./lib/pubid/ieee/identifier/base.rb:120:in `dual_identifier'
     # ./lib/pubid/ieee/identifier/base.rb:105:in `to_s'
     # ./spec/pubid_ieee/identifiers_parsing_spec.rb:17:in `block (3 levels) in <module:Ieee>'

Finished in 20.56 seconds (files took 0.372 seconds to load)
321 examples, 3 failures

Failed examples:

rspec ./spec/pubid_ieee/identifiers_parsing_spec.rb[1:1:13:1:1] # Pubid::Ieee::Identifier parse specific identifiers IEC/IEEE 60076-16 Edition 2.0 2018-09 behaves like converts pubid to pubid converts pubid to pubid
rspec ./spec/pubid_ieee/identifiers_parsing_spec.rb[1:1:18:1:1] # Pubid::Ieee::Identifier parse specific identifiers IEC 61523-3 First edition 2004-09 behaves like converts pubid to pubid converts pubid to pubid
rspec ./spec/pubid_ieee/identifiers_parsing_spec.rb[1:1:96:1:1] # Pubid::Ieee::Identifier parse specific identifiers IEC/IEEE 62582-1:2011 Edition 1.0 2011-08 behaves like converts pubid to pubid converts pubid to pubid

When I run it, month is NOT an integer, it is a string. Passing it to "%d" is an error.

Originally posted by @opoudjis in https://github.com/metanorma/pubid-ieee/issues/86#issuecomment-1557676741

CAMOBAP commented 12 months ago

https://github.com/metanorma/pubid-ieee/pull/106

ronaldtse commented 12 months ago

Done.