-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #106, using rappdirs now for caching
- Loading branch information
Showing
4 changed files
with
73 additions
and
60 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 |
---|---|---|
|
@@ -28,7 +28,8 @@ Imports: | |
R6, | ||
shiny, | ||
miniUI, | ||
stringr | ||
stringr, | ||
rappdirs | ||
Suggests: | ||
roxygen2 (>= 5.0.1), | ||
testthat, | ||
|
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.
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,36 +1,39 @@ | ||
# # context("testing cr_ft_text") | ||
# | ||
# links <- cr_ft_links("10.3897/phytokeys.42.7604", "all") | ||
context("cr_ft_text") | ||
|
||
# out <- cr_works( | ||
# filter = list(has_full_text = TRUE, license_url = "http://creativecommons.org/licenses/by/4.0/"), | ||
# limit = 100 | ||
# ) | ||
|
||
# links <- cr_ft_links("10.7717/peerj.1282") | ||
# xml1 <- cr_ft_text(links, 'xml') | ||
# pdf_read <- cr_ft_text(links, "pdf", read=FALSE, verbose = FALSE) | ||
# pdf <- cr_ft_text(links, "pdf", verbose = FALSE) | ||
# | ||
# test_that("cr_ft_text returns correct class", { | ||
# expect_is(xml1, "XMLInternalDocument") | ||
# expect_is(pdf_read, "character") | ||
# expect_is(pdf, "xpdf_char") | ||
# }) | ||
# | ||
# test_that("cr_ft_text dimensions are correct", { | ||
# expect_equal(length(xml1), 1) | ||
# expect_equal(length(pdf_read), 1) | ||
# expect_equal(length(pdf), 2) | ||
# expect_equal(length(pdf$meta), 14) | ||
# expect_equal(length(pdf$data), 1) | ||
# }) | ||
# | ||
|
||
test_that("cr_ft_text works: pdf", { | ||
links <- cr_ft_links("10.1155/mbd.1994.183", "all") | ||
pdf_read <- cr_ft_text(links, "pdf", read = FALSE, verbose = FALSE) | ||
pdf <- cr_ft_text(links, "pdf", verbose = FALSE) | ||
#expect_is(xml1, "xml_document") | ||
expect_is(pdf_read, "character") | ||
expect_is(pdf, "xpdf_char") | ||
#expect_equal(length(xml1), 2) | ||
expect_equal(length(pdf_read), 1) | ||
expect_equal(length(pdf), 2) | ||
expect_equal(length(pdf$meta), 14) | ||
expect_equal(length(pdf$data), 1) | ||
}) | ||
|
||
# test_that("cr_ft_text gives back right values", { | ||
# library("XML") | ||
# expect_match(xpathApply(xml1, "//ref", xmlValue)[[1]], "Ake AssiL") | ||
# library("xml2") | ||
# expect_match(xml2::xml_find_all(xml1, "//ref")[[1]], "Ake AssiL") | ||
# expect_match(pdf_read, "~/.crossref") | ||
# | ||
# # nms <- c('Title','Author','Creator','Producer','CreationDate','ModDate','Tagged','Form', | ||
# # 'Pages','Encrypted','Page size','File size','Optimized','PDF version') | ||
# # expect_named(pdf$meta, nms) | ||
# }) | ||
# | ||
# test_that("cr_ft_text fails correctly", { | ||
# expect_error(cr_ft_text(), 'argument "url" is missing') | ||
# expect_error(cr_ft_text("3434"), "Chosen type value not available in links") | ||
# expect_error(cr_ft_text(links, type = "adfasf"), "'arg' should be one of") | ||
# }) | ||
|
||
test_that("cr_ft_text fails correctly", { | ||
expect_error(cr_ft_text(), 'argument "url" is missing') | ||
expect_error(cr_ft_text("3434"), "a character vector argument expected") | ||
|
||
links <- cr_ft_links("10.1155/mbd.1994.183", "all") | ||
expect_error(cr_ft_text(links, type = "adfasf"), "'arg' should be one of") | ||
}) |