summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-06-26 22:44:33 +0900
committerRandy Morgan <[email protected]>2012-06-26 22:44:33 +0900
commitf56a253539ea5d932eb3c6fc0fdba7f07377ad02 (patch)
treec0d2a04de7bcd5bb8b48d462106e4b9f698fae32 /test
parent053ff02c4e10ba6b6ebbc0107b5ba3cf78caa00d (diff)
downloadcaxlsx-f56a253539ea5d932eb3c6fc0fdba7f07377ad02.tar.gz
caxlsx-f56a253539ea5d932eb3c6fc0fdba7f07377ad02.zip
fixes #105 - disallow control characters.
thanks to asakusarb - I found out about [:cntrl:] -- so no more control characters can accidentally get pushed into y our xlsx.
Diffstat (limited to 'test')
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index 7cc44a52..931ec51b 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -308,11 +308,8 @@ class TestWorksheet < Test::Unit::TestCase
def test_to_xml_string_with_illegal_chars
nasties = "\v\u2028\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u001f"
@ws.add_row [nasties]
- assert_equal(nasties, @ws.rows.last.cells.last.value)
- schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
- doc = Nokogiri::XML(@ws.to_xml_string)
-
- assert(schema.validate(doc).map { |e| puts e.message; e }.empty?)
+ assert_equal(0, @ws.rows.last.cells.last.value.index("\v"))
+ assert_equal(nil,@ws.to_xml_string.index("\v"))
end
# Make sure the XML for all optional elements (like pageMargins, autoFilter, ...)
# is generated in correct order.