summaryrefslogtreecommitdiffstats
path: root/test/roo
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-03-19 21:47:36 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-03-19 21:47:36 -0400
commitf5fb17e5a64b215644bc104f099dad8c2f10c37d (patch)
tree6ad047451881cfe94f3aabe1c33b404c134a5085 /test/roo
parent9e07e8cd4836ddc89accdb7b20152c9a4f06fd03 (diff)
New upstream version 2.9.0.upstream/2.9.0
Diffstat (limited to 'test/roo')
-rw-r--r--test/roo/test_excelx.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/roo/test_excelx.rb b/test/roo/test_excelx.rb
index 90c7167..61161f0 100644
--- a/test/roo/test_excelx.rb
+++ b/test/roo/test_excelx.rb
@@ -133,6 +133,20 @@ class TestRworkbookExcelx < Minitest::Test
end
end
+ def test_expand_merged_range_doesnt_insert_nil_values
+ options = { expand_merged_ranges: true }
+ xlsx = roo_class.new(File.join(TESTDIR, "merged_ranges.xlsx"), options)
+
+ refute_includes xlsx.sheet_for(0).cells.values, nil, "`nil` was copied into the cells hash from an empty merged range"
+ end
+
+ def test_expand_merged_range_doesnt_raise_issue_506
+ # Issue 506 sent an example test.xlsx file that would raise an error upon parsing.
+ xl = Roo::Spreadsheet.open(File.join(TESTDIR, "expand_merged_ranges_issue_506.xlsx"), expand_merged_ranges: true)
+ data = xl.parse(one: /one/i, two: /two/i, clean: true)
+ assert_equal [{:one=>"John", :two=>"Johnson"}, {:one=>"Sam", :two=>nil}, {:one=>"Dave", :two=>nil}], data
+ end
+
def test_noexpand_merged_range
xlsx = roo_class.new(File.join(TESTDIR, "merged_ranges.xlsx"))
@@ -320,6 +334,13 @@ class TestRworkbookExcelx < Minitest::Test
end
end
+ def test_parsing_xlsx_with_richtext
+ xlsx = roo_class.new(File.join(TESTDIR, "richtext_example.xlsx"))
+
+ assert_equal "Example richtext", xlsx.cell("a", 1)
+ assert_equal "Example richtext", xlsx.cell("b", 1)
+ end
+
def roo_class
Roo::Excelx
end