Sha256: ecd0dbc6ffe5d7dcdf688fd8de5817e5426cf3582d07ee0eb9cac4da08b99c4d
Contents?: true
Size: 1022 Bytes
Versions: 2
Compression:
Stored size: 1022 Bytes
Contents
require 'test/unit' require 'axlsx.rb' class TestSharedStringsTable < Test::Unit::TestCase def setup @p = Axlsx::Package.new :use_shared_strings=>true ws = @p.workbook.add_worksheet ws.add_row ['a', 1, 'b'] ws.add_row ['b', 1, 'c'] ws.add_row ['c', 1, 'd'] end def test_workbook_has_shared_strings assert(@p.workbook.shared_strings.is_a?(Axlsx::SharedStringsTable), "shared string table was not created") end def test_count sst = @p.workbook.shared_strings assert_equal(sst.count, 6) end def test_unique_count sst = @p.workbook.shared_strings assert_equal(sst.unique_count, 4) end def test_valid_document schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) doc = Nokogiri::XML(@p.workbook.shared_strings.to_xml) errors = [] schema.validate(doc).each do |error| puts error.message errors << error end assert_equal(errors.size, 0, "sharedStirngs.xml Invalid" + errors.map{ |e| e.message }.to_s) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
axlsx-1.0.18 | test/workbook/tc_shared_strings_table.rb |
axlsx-1.0.17 | test/workbook/tc_shared_strings_table.rb |