From 82331ab312935111217359b0a24cc20acaf9457e Mon Sep 17 00:00:00 2001 From: Rob Donnelly Date: Wed, 3 Feb 2021 13:08:02 -0800 Subject: Add test for special characters in pivot table cache definition --- test/workbook/worksheet/tc_pivot_table_cache_definition.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/workbook/worksheet/tc_pivot_table_cache_definition.rb b/test/workbook/worksheet/tc_pivot_table_cache_definition.rb index 282078b0..37d7e485 100644 --- a/test/workbook/worksheet/tc_pivot_table_cache_definition.rb +++ b/test/workbook/worksheet/tc_pivot_table_cache_definition.rb @@ -51,4 +51,12 @@ class TestPivotTableCacheDefinition < Test::Unit::TestCase assert(errors.empty?, "error free validation") end + def test_to_xml_string_for_special_characters + cell = @ws.rows.first.cells.first + cell.value = "&><'\"" + + doc = Nokogiri::XML(@cache_definition.to_xml_string) + errors = doc.errors + assert(errors.empty?, "invalid xml: #{errors.map(&:to_s).join(', ')}") + end end -- cgit v1.2.3