Sha256: 880a7b9fa382ed797ffaa51d7732bd49b22a4d908f508c11f92af339f0a12e0a

Contents?: true

Size: 917 Bytes

Versions: 5

Compression:

Stored size: 917 Bytes

Contents

require 'spec_helper'

RSpec.describe Prawn::SVG::CSS::FontFamilyParser do
  describe '#parse' do
    it 'correctly handles quotes and escaping' do
      tests = {
        ''                         => [],
        'font'                     => ['font'],
        'font name, other font'    => ['font name', 'other font'],
        "'font name', other font"  => ['font name', 'other font'],
        "'font, name', other font" => ['font, name', 'other font'],
        '"font name", other font'  => ['font name', 'other font'],
        '"font, name", other font' => ['font, name', 'other font'],
        'weird \\" name'           => ['weird " name'],
        'weird\\, name'            => ['weird, name'],
        ' stupid , spacing '       => ['stupid', 'spacing']
      }

      tests.each do |string, expected|
        expect(Prawn::SVG::CSS::FontFamilyParser.parse(string)).to eq expected
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prawn-svg-0.36.2 spec/prawn/svg/css/font_family_parser_spec.rb
prawn-svg-0.36.1 spec/prawn/svg/css/font_family_parser_spec.rb
prawn-svg-0.36.0 spec/prawn/svg/css/font_family_parser_spec.rb
prawn-svg-0.35.1 spec/prawn/svg/css/font_family_parser_spec.rb
prawn-svg-0.35.0 spec/prawn/svg/css/font_family_parser_spec.rb