@@ -133,7 +133,8 @@ testthat::test_that("eval_code returns a qenv object with empty messages and war
133133testthat :: test_that(" eval_code returns a qenv object with dependency attribute" , {
134134 q <- eval_code(qenv(), " iris_data <- head(iris)" )
135135 testthat :: expect_identical(get_code_attr(q , " dependency" ), c(" iris_data" , " <-" , " head" , " iris" ))
136-
136+ })
137+ testthat :: test_that(" eval_code returns a qenv object with dependency attribute that contains linksto information" , {
137138 q2 <- eval_code(qenv(), c(" x <- 5" , " iris_data <- head(iris)" , " nrow(iris_data) #@linksto x" ))
138139 testthat :: expect_identical(
139140 lapply(q2 @ code , attr , " dependency" ),
@@ -143,7 +144,15 @@ testthat::test_that("eval_code returns a qenv object with dependency attribute",
143144 c(" x" , " <-" , " nrow" , " iris_data" )
144145 )
145146 )
146-
147- q3 <- eval_code(qenv(), c(" library(survival)" , " library(utils)" , " x <- 5" ))
148- lapply(q3 @ code , attr , " dependency" )
147+ })
148+ testthat :: test_that(
149+ " eval_code returns a qenv object with dependency attribute that extracts functions after '<-' part" , {
150+ q3 <- eval_code(qenv(), c(" library(survival)" , " head(iris)" ))
151+ testthat :: expect_identical(
152+ lapply(q3 @ code , attr , " dependency" ),
153+ list (
154+ c(" <-" , " library" , " survival" ),
155+ c(" <-" , " head" , " iris" )
156+ )
157+ )
149158})
0 commit comments