-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix #151 * Cover the uncovered line * Refactor `.determine_ods_format` to be reused in `list_ods_sheets` * Cover the uncovered line * Make `list_ods_sheets` a common interface
- Loading branch information
1 parent
ace1dfe
commit 2a703c9
Showing
8 changed files
with
136 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: readODS | ||
Type: Package | ||
Title: Read and Write ODS Files | ||
Version: 2.1.1 | ||
Version: 2.2.0 | ||
Authors@R: | ||
c(person("Gerrit-Jan", "Schutten", role = c("aut"), email = "[email protected]"), | ||
person("Chung-hong", "Chan", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-6232-7530")), | ||
|
@@ -29,7 +29,8 @@ Imports: | |
stringi, | ||
tibble, | ||
vctrs (>= 0.4.2), | ||
zip | ||
zip, | ||
tools | ||
LinkingTo: | ||
cpp11 (>= 0.4.6) | ||
Suggests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
test_that(".determine_ods_format works", { | ||
expect_equal(.determine_ods_format(readODS::write_ods(iris)), "ods") | ||
expect_equal(.determine_ods_format(readODS::write_fods(iris)), "fods") | ||
expect_equal(.determine_ods_format(readODS::write_ods(iris, tempfile(fileext = ".fods"))), "fods") | ||
expect_equal(.determine_ods_format(readODS::write_ods(iris, tempfile(fileext = ".fods")), guess = TRUE), "ods") | ||
expect_equal(.determine_ods_format(readODS::write_fods(iris, tempfile(fileext = ".xml"))), "fods") | ||
expect_equal(.determine_ods_format(readODS::write_ods(iris, tempfile(fileext = ".fods")), guess = TRUE), "ods") | ||
expect_equal(.determine_ods_format(readODS::write_ods(iris, tempfile(fileext = ".xml"))), "fods") | ||
expect_equal(.determine_ods_format(readODS::write_ods(iris, tempfile(fileext = ".xml")), guess = TRUE), "ods") | ||
expect_equal(.determine_ods_format(readODS::write_fods(iris, tempfile(fileext = ".ods")), guess = TRUE), "fods") | ||
## don't guess | ||
expect_equal(.determine_ods_format(readODS::write_fods(iris, tempfile(fileext = ".ods")), ods_format = "zip"), "zip") | ||
}) | ||
|
||
test_that("integration in read_ods", { | ||
expect_error(readODS::read_ods(readODS::write_fods(iris)), NA) | ||
expect_error(readODS::read_ods(readODS::write_ods(iris)), NA) | ||
expect_error(readODS::read_fods(readODS::write_ods(iris))) ## err, read_fods is not a common interface | ||
expect_error(readODS::read_fods(readODS::write_fods(iris)), NA) | ||
## override | ||
temp_fods <- tempfile(fileext = ".fods") | ||
expect_error(readODS::read_ods(readODS::write_ods(iris, temp_fods), ods_format = "ods"), NA) | ||
expect_error(readODS::read_ods(readODS::write_ods(iris, temp_fods), guess = TRUE), NA) | ||
}) | ||
|
||
test_that("integration in list_ods_sheets", { | ||
expect_error(readODS::list_ods_sheets(readODS::write_fods(iris)), NA) | ||
expect_error(readODS::list_ods_sheets(readODS::write_ods(iris)), NA) | ||
expect_error(readODS::list_fods_sheets(readODS::write_ods(iris))) ## err | ||
temp_fods <- tempfile(fileext = ".fods") | ||
expect_error(readODS::list_ods_sheets(readODS::write_ods(iris, temp_fods), ods_format = "ods"), NA) | ||
expect_error(readODS::list_ods_sheets(readODS::write_ods(iris, temp_fods), guess = TRUE), NA) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters