diff options
| author | randym <[email protected]> | 2018-02-07 11:21:00 +0900 |
|---|---|---|
| committer | randym <[email protected]> | 2018-02-07 11:21:00 +0900 |
| commit | 3f34514ecf53fb4a3401b5336833bbeb439efe2a (patch) | |
| tree | 5a911a498db05f87756313e6d737e866dd37d176 /test | |
| parent | 14c05d69ddf555528bb20991d289454d5350969c (diff) | |
| parent | 545d77371cf81c368ccfd761e5409cbc7e141711 (diff) | |
| download | caxlsx-3f34514ecf53fb4a3401b5336833bbeb439efe2a.tar.gz caxlsx-3f34514ecf53fb4a3401b5336833bbeb439efe2a.zip | |
Merge branch 'master' into release-3.0.0
Diffstat (limited to 'test')
| -rw-r--r-- | test/tc_axlsx.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb index 99832f63..3d6a2e70 100644 --- a/test/tc_axlsx.rb +++ b/test/tc_axlsx.rb @@ -79,4 +79,25 @@ class TestAxlsx < Test::Unit::TestCase assert_equal([['Z5', 'AA5', 'AB5'], ['Z6', 'AA6', 'AB6']], Axlsx::range_to_a('Z5:AB6')) end + def test_sanitize_frozen_control_strippped + needs_sanitize = "legit\x08".freeze # Backspace control char + + assert_equal(Axlsx.sanitize(needs_sanitize), 'legit', 'should strip control chars') + end + + def test_sanitize_unfrozen_control_strippped + needs_sanitize = "legit\x08" # Backspace control char + sanitized_str = Axlsx.sanitize(needs_sanitize) + + assert_equal(sanitized_str, 'legit', 'should strip control chars') + assert_equal(sanitized_str.object_id, sanitized_str.object_id, 'should preserve object') + end + + def test_sanitize_unfrozen_no_sanitize + legit_str = 'legit' + sanitized_str = Axlsx.sanitize(legit_str) + + assert_equal(sanitized_str, legit_str, 'should preserve value') + assert_equal(sanitized_str.object_id, legit_str.object_id, 'should preserve object') + end end |
