为什么test中的helper文件源代码是两次
在测试中使用UUID时,我遇到了麻烦,因为助手文件来源了两次。为什么会这样?有没有办法避免二次采购 对于一个可复制的示例,只需创建一个新包,将名为“helper data.R”的文件放入/tests/testhat/中,并包含以下内容为什么test中的helper文件源代码是两次,r,testthat,R,Testthat,在测试中使用UUID时,我遇到了麻烦,因为助手文件来源了两次。为什么会这样?有没有办法避免二次采购 对于一个可复制的示例,只需创建一个新包,将名为“helper data.R”的文件放入/tests/testhat/中,并包含以下内容 if (!exists("test_ind")) { test_ind <- 1 print(paste0("test_ind = ", test_ind)) test_ind <- test_ind + 1 } else { prin
if (!exists("test_ind")) {
test_ind <- 1
print(paste0("test_ind = ", test_ind))
test_ind <- test_ind + 1
} else {
print(paste0("test_ind = ", test_ind))
test_ind <- test_ind + 1
}
最后你会看到测试ind是2。
我找到了链接,但我不知道如何解决我的问题
更新:在上创建了一个问题。我刚刚收到一条消息,这一问题已在中解决
context("test1")
test_that("test1", {
# expect_equal(1, 1)
})