Skip to content

Commit

Permalink
Fix #881
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed May 24, 2019
1 parent a1080c4 commit f1b45c6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Bug fixes

- Do not rehash large imported files every `make()` [#878](https://github.com/ropensci/drake/issues/878).
- Do not rehash large imported files every `make()` ([#878](https://github.com/ropensci/drake/issues/878)).
- Repair parsing of long tidy eval inputs in the DSL ([#878](https://github.com/ropensci/drake/issues/881)).

## New features

Expand Down
2 changes: 1 addition & 1 deletion R/api-dsl.R
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ explicit_new_groupings <- function(code, exclude = character(0)) {
if (is.call(x)) {
x <- x[-1]
}
as.character(lapply(as.list(x), deparse))
as.character(lapply(as.list(x), long_deparse))
})
}

Expand Down
4 changes: 4 additions & 0 deletions R/utils-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ fill_cols <- function(x, cols) {
x
}

long_deparse <- function(x, collapse = "\n") {
paste(deparse(x), collapse = collapse)
}

safe_deparse <- function(x, collapse = "\n") {
paste(
deparse(x, control = c("keepInteger", "keepNA")),
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ else's
eng
envir
ETag
eval
Factual's
Falster
faq
Expand Down
26 changes: 26 additions & 0 deletions tests/testthat/test-dsl.R
Original file line number Diff line number Diff line change
Expand Up @@ -2501,3 +2501,29 @@ test_with_dir("splitting with tidy eval", {
)
equivalent_plans(out, exp)
})

test_with_dir("parse long tidyeval inputs", {
l <- lapply(100, function(x) rep("a", x))
out <- drake_plan(
a = target(
length(x),
transform = map(x = !!l, y = !!seq_along(l), .id = y)
)
)
exp <- drake_plan(
a_1L = length(
c(
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
"a", "a", "a", "a", "a"
)
)
)
equivalent_plans(out, exp)
})

0 comments on commit f1b45c6

Please sign in to comment.