Skip to content

Commit

Permalink
added fix
Browse files Browse the repository at this point in the history
  • Loading branch information
salix-d committed Mar 26, 2024
1 parent 90e44fb commit 53ed0bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ b_read_xml <- function(x) {
}
b_read_tsv <- function(x, header = TRUE, sep = "\t",
cleanData = FALSE, ...) {
# -- fix for issue 104 ----------------------------------------
# wild '\n' characters in some fields
if (stringi::stri_detect_regex(x, "[^\r]\n[^\r]")) {
x_names <- stringi::stri_extract_first_regex(x, "^[^\r\n]+")
x_names <- stringi::stri_split_regex(x_names, "\t", simplify = TRUE)
pttrn <- paste0("(?<!", x_names[length(x_names)], "|\r)\n(?!=\r)")
x <- stringi::stri_replace_all_regex(x, pttrn, " ")
}
# -------------------------------------------------------------
x <- data.table::setDF(
data.table::fread(
text = x,
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-bold_specimens.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ test_that("bold_seq fails well", {
expect_error(bold_specimens(geo = 'Costa Rica', timeout_ms = 2), "Timeout was reached")
})

# TODO: add test for 'Molgula manhattensis' (issue 104)

# FIXME: The test wasn't doing that, removed it. Afaik, this function doesn't throw a warning for this.
# test_that("Throws warning on call that takes forever including timeout in callopts", {})

0 comments on commit 53ed0bf

Please sign in to comment.