Skip to content

Commit

Permalink
fix : improve check
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentGuyader committed Feb 17, 2024
1 parent 2df6318 commit a825b5d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
4 changes: 2 additions & 2 deletions inst/dummyfolder/global.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
library(dplyr)
library(sudoku)
library(extrapackage)
library(glue)
2 changes: 1 addition & 1 deletion inst/dummyfolder/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# http://shiny.rstudio.com/
#

library(shiny)
# library(shiny)

# Define server logic required to draw a histogram
function(input, output, session) {
Expand Down
2 changes: 1 addition & 1 deletion inst/dummyfolder/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# http://shiny.rstudio.com/
#

library(shiny)
# library(shiny)

# Define UI for application that draws a histogram
fluidPage(
Expand Down
47 changes: 45 additions & 2 deletions tests/testthat/test-renv_create2.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@ file.copy(
recursive = TRUE
)
dummyfolder <- file.path(tmpdir, "dummyfolder")







# Create a second dummy package that will be a dependance of dummy
# So that, we are sure it does not exists on CRAN for extra checks
extra_path <- file.path(tmpdir, "dummy.extra")
dir.create(extra_path, recursive = TRUE)
file.copy(
system.file("dummypackage", package = "attachment"),
extra_path,
recursive = TRUE
)
extrapackage <- file.path(extra_path, "extrapackage")
file.rename(file.path(extra_path, "dummypackage"), extrapackage)
# Rename package and remove 'Rcpp'
desc_lines <- readLines(file.path(extrapackage, "DESCRIPTION"))
desc_lines <- gsub("dummypackage", "extrapackage", desc_lines)
desc_lines <- desc_lines[-grep("LinkingTo|Rcpp", desc_lines)]
cat(desc_lines, sep = "\n", file = file.path(extrapackage, "DESCRIPTION"))
# Remove calls to 'dummypackage' and 'Rcpp'
unlink(file.path(extrapackage, "tests"), recursive = TRUE)
# document
# inuse <- search()
att_amend_desc(path = extrapackage)
unloadNamespace("extrapackage") # for windows mainly
# Install package to make it available to {renv}
install.packages(extrapackage, repos = NULL, type = "source")












lock_ <- file.path(tmpdir, "my_lock.lock")


Expand Down Expand Up @@ -42,8 +85,8 @@ renv_content <- getFromNamespace("lockfile", "renv")(my_renv_)

test_that("lockfile are correct renv files", {
expect_s3_class(renv_content, "renv_lockfile_api")
expect_true("dplyr" %in% names(renv_content$data()$Packages))
expect_true("sudoku" %in% names(renv_content$data()$Packages))
expect_true("glue" %in% names(renv_content$data()$Packages))
expect_true("extrapackage" %in% names(renv_content$data()$Packages))
})


0 comments on commit a825b5d

Please sign in to comment.