From 96df3bd54df0189cfc33f48359b195897892ec8e Mon Sep 17 00:00:00 2001 From: nacnudus Date: Mon, 13 Feb 2017 20:06:53 +0000 Subject: [PATCH] Import whole of multiline comments (#9) --- src/xlsxsheet.cpp | 2 +- tests/testthat/test-comments.R | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/test-comments.R diff --git a/src/xlsxsheet.cpp b/src/xlsxsheet.cpp index 5e03ada..ad6f3a4 100644 --- a/src/xlsxsheet.cpp +++ b/src/xlsxsheet.cpp @@ -173,7 +173,7 @@ void xlsxsheet::cacheComments(Rcpp::String comments_path) { for (rapidxml::xml_node<>* comment = commentList->first_node(); comment; comment = comment->next_sibling()) { std::string ref(comment->first_attribute("ref")->value()); - rapidxml::xml_node<>* r = comment->first_node()->first_node(); + rapidxml::xml_node<>* r = comment->first_node(); // Get the inline string std::string inlineString; parseString(r, inlineString); // value is modified in place diff --git a/tests/testthat/test-comments.R b/tests/testthat/test-comments.R new file mode 100644 index 0000000..01130b6 --- /dev/null +++ b/tests/testthat/test-comments.R @@ -0,0 +1,6 @@ +context("Comments") + +test_that("multiline comments are returned in full", { + expect_equal(tidy_xlsx("examples.xlsx")$data$Sheet1$comment[19], + "commentwithtextformatting") +})