Skip to content

Commit f878fed

Browse files
gogonzoaverissimo
andauthored
Apply suggestions from code review
Co-authored-by: André Veríssimo <[email protected]> Signed-off-by: Dawid Kałędkowski <[email protected]>
1 parent 6995ae5 commit f878fed

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

R/qenv-get_outputs.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@
2121
#' @export
2222
setGeneric("get_outputs", function(object) standardGeneric("get_outputs"))
2323

24-
25-
2624
setMethod("get_outputs", signature = "qenv", function(object) {
2725
Reduce(
28-
function(x, y) {
29-
c(x, attr(y, "outputs"))
30-
},
26+
function(x, y) c(x, attr(y, "outputs")),
3127
init = list(),
3228
x = object@code
3329
)

tests/testthat/test-get_outputs.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ testthat::describe("get_output", {
3737
expected <- simpleMessage("test\n", call = quote(message("test")))
3838
testthat::expect_identical(get_outputs(q1), list(expected))
3939
})
40+
testthat::it("prints inside for are bundled together", {
41+
q <- within(qenv(), for (i in 1:3) print(i))
42+
testthat::expect_identical(get_outputs(q)[[1]], "[1] 1\n[1] 2\n[1] 3\n")
43+
})
4044
})

0 commit comments

Comments
 (0)