Skip to content

Commit 5d3cee9

Browse files
committed
Merge branch '218_deprecate_get_code@main' of https://github.com/insightsengineering/teal.code into 218_deprecate_get_code@main
2 parents 2b2d16c + 227d766 commit 5d3cee9

File tree

5 files changed

+132
-11
lines changed

5 files changed

+132
-11
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ Collate:
6666
'qenv-show.R'
6767
'qenv-within.R'
6868
'teal.code-package.R'
69+
'utils-get_code_dependency.R'
6970
'utils.R'

R/qenv-get_code.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@
8080
#'
8181
#' @examples
8282
#' # retrieve code
83-
#' q <- within(qenv(), {a <- 1; b <- 2})
83+
#' q <- within(qenv(), {
84+
#' a <- 1
85+
#' b <- 2
86+
#' })
8487
#' get_code(q)
8588
#' get_code(q, deparse = FALSE)
8689
#' get_code(q, names = "a")

man/get_code_dependency.Rd

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/qenv.Rd

Lines changed: 81 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-qenv_get_code.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,10 @@ testthat::test_that(
446446
testthat::expect_identical(
447447
get_code(q, names = "classes"),
448448
paste("iris2 <- iris[1:5, ]",
449-
"iris_head <- head(iris)",
450-
"iris3 <- iris_head[1, ]",
451-
"classes <- lapply(iris2, class)",
452-
sep = "\n"
449+
"iris_head <- head(iris)",
450+
"iris3 <- iris_head[1, ]",
451+
"classes <- lapply(iris2, class)",
452+
sep = "\n"
453453
)
454454
)
455455
}
@@ -614,11 +614,11 @@ testthat::test_that("understands $ usage and do not treat rhs of $ as objects (o
614614
testthat::expect_identical(
615615
get_code(q, names = "a"),
616616
paste("x <- data.frame(a = 1:3)",
617-
"a <- data.frame(y = 1:3)",
618-
"a$x <- a$y",
619-
"a$x <- a$x + 2",
620-
"a$x <- x$a",
621-
sep = "\n"
617+
"a <- data.frame(y = 1:3)",
618+
"a$x <- a$y",
619+
"a$x <- a$x + 2",
620+
"a$x <- x$a",
621+
sep = "\n"
622622
)
623623
)
624624
})

0 commit comments

Comments
 (0)