Sha256: d2073c2cbb4353066b10d8aa1635aa37a27ba8958e70d63b8dcd73ddf8772835

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe RubyXL::Text do
  describe '.to_s' do
    it 'should not crash processing UNICODE data' do
      bytes = [ 114, 39, 95, 120, 48, 48, 56, 48, 95, 226, 132, 162, 115,
                32, 103, 105, 114, 108, 102, 114, 105, 101, 110, 100,
                39, 95, 120, 48, 48, 56, 48, 95, 226, 132, 162, 115, 32, 104, 111]

      t = RubyXL::Text.new(:value => bytes.pack('c*').force_encoding('UTF-8'))

      str = t.to_s

      expect(str).to be
    end

    it 'should not escape valid XML extended UNICODE characters' do
      t = RubyXL::Text.new(:value => "\u{10000}\u{10FFFF}")

      xml = t.write_xml[%r{<t>[^<]+</t>}]

      expect(xml).to eq("<t>\u{10000}\u{10FFFF}</t>")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubyXL-3.4.33 spec/lib/text_spec.rb
rubyXL-3.4.32 spec/lib/text_spec.rb
rubyXL-3.4.31 spec/lib/text_spec.rb
rubyXL-3.4.30 spec/lib/text_spec.rb
rubyXL-3.4.29 spec/lib/text_spec.rb
rubyXL-3.4.28 spec/lib/text_spec.rb