diff options
| author | Rob Donnelly <[email protected]> | 2021-02-03 12:18:29 -0800 |
|---|---|---|
| committer | Rob Donnelly <[email protected]> | 2021-02-03 12:18:29 -0800 |
| commit | 40ef081e4d6b468d308c89324b49e551e8cad266 (patch) | |
| tree | 70a1b78b1d79a47567aabb872592b673538e445b /test | |
| parent | cda1ce451db1c0754f1e102e1d809467c79a6d8f (diff) | |
| download | caxlsx-40ef081e4d6b468d308c89324b49e551e8cad266.tar.gz caxlsx-40ef081e4d6b468d308c89324b49e551e8cad266.zip | |
Add test for special characters in table header
Diffstat (limited to 'test')
| -rw-r--r-- | test/workbook/worksheet/tc_table.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_table.rb b/test/workbook/worksheet/tc_table.rb index 8edfc099..f35210b9 100644 --- a/test/workbook/worksheet/tc_table.rb +++ b/test/workbook/worksheet/tc_table.rb @@ -64,4 +64,19 @@ class TestTable < Test::Unit::TestCase end assert(errors.empty?, "error free validation") end + + def test_to_xml_string_for_special_characters + cell = @ws.rows.first.cells.first + cell.value = "&><'\"" + + table = @ws.add_table("A1:D5") + schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD)) + doc = Nokogiri::XML(table.to_xml_string) + errors = [] + schema.validate(doc).each do |error| + errors.push error + puts error.message + end + assert(errors.empty?, "error free validation") + end end |
