summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/workbook/tc_shared_strings_table.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/workbook/tc_shared_strings_table.rb b/test/workbook/tc_shared_strings_table.rb
index 7a333f4f..1656dfbd 100644
--- a/test/workbook/tc_shared_strings_table.rb
+++ b/test/workbook/tc_shared_strings_table.rb
@@ -41,4 +41,18 @@ class TestSharedStringsTable < Test::Unit::TestCase
assert_equal(errors.size, 0, "sharedStirngs.xml Invalid" + errors.map{ |e| e.message }.to_s)
end
+ def test_remove_control_characters_in_xml_serialization
+ nasties = "hello\x10\x00\x1C\x1Eworld"
+ @p.workbook.worksheets[0].add_row [nasties]
+
+ # test that the nasty string was added to the shared strings
+ assert @p.workbook.shared_strings.unique_cells.has_key?(nasties)
+
+ # test that none of the control characters are in the XML output for shared strings
+ assert_no_match /#{Axlsx::CONTROL_CHARS}/, @p.workbook.shared_strings.to_xml_string
+
+ # assert that the shared string was normalized to remove the control characters
+ assert_not_nil @p.workbook.shared_strings.to_xml_string.index("helloworld")
+ end
+
end