ONLYOFFICE-QA / ooxml_parser

Ruby OOXML Parser
GNU Affero General Public License v3.0
86 stars 22 forks source link

Add support of `simplecov` branch coverage #721

Open ShockwaveNN opened 3 years ago

ShockwaveNN commented 3 years ago

Seems this is rather difficult task

Branch coverage do not like construction like this:

      node.xpath('*').each do |preset_geometry_child|
        case preset_geometry_child.name
        when 'pctWidth'
          @width = PictureDimension.new(parent: self).parse(preset_geometry_child)
        end
      end

I've tried to add else case with something like this:

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'pctWidth'
          @width = PictureDimension.new(parent: self).parse(node_child)
        else
          Parser.logger.info("Unsupported child node #{node_child.name}")
        end
      end

But this do not solve problem, since there is no files who get in else branch any way, so not only branch coverage is not changed, but default coverage is decreased