
test_that("dependencies_file_text works", {
  expect_true(inherits(dependencies_file_text, "function")) 
  
  remo <- c("ThinkR-open/attachment", "local::/path/fakelocal", "gitlab::statnmap/fakepkg", 
"bioc::3.3/fakepkgbioc", "git::https://github.com/fakepkggit.git", 
"git::https://MyForge.com/fakepkggit2r", "ThinkR-open/fusen")
ll <- c("knitr", "magrittr", "rmarkdown", "testthat")

thetext <- dependencies_file_text(ll, remo, FALSE)
  expect_equal(class(thetext), "list")
  expect_length(thetext, 2)
  expect_equal(names(thetext), c("remotes_content","attachment_content"))
  
  

  expect_equal(thetext[1], list(remotes_content = "# Remotes ----\ninstall.packages(\"remotes\")\nremotes::install_github('ThinkR-open/attachment')\nremotes::install_local('path/fakelocal')\nremotes::install_gitlab('statnmap/fakepkg')\nremotes::install_bioc('3.3/fakepkgbioc')\nremotes::install_git('https://github.com/fakepkggit.git')\nremotes::install_git('https://MyForge.com/fakepkggit2r')\nremotes::install_github('ThinkR-open/fusen')"))
  
  expect_equal(thetext[2], list(attachment_content = structure("# Attachments ----\nto_install <- c(\"knitr\", \"magrittr\", \"rmarkdown\", \"testthat\")\n  for (i in to_install) {\n    message(paste(\"looking for \", i))\n    if (!requireNamespace(i, quietly = TRUE)) {\n      message(paste(\"     installing\", i))\n      install.packages(i)\n    }\n  }\n", class = c("glue", 
"character"))))



remo <- NULL
ll <- NULL

thetext2 <- dependencies_file_text(ll, remo, FALSE)
expect_equal(class(thetext2), "list")
expect_length(thetext2, 2)
expect_equal(names(thetext2), c("remotes_content", "attachment_content"))

expect_equal(thetext2[1],list(remotes_content = "# No Remotes ----"))

expect_equal(thetext2[2], list(attachment_content = structure("# No attachments ----\n      \n", class = c("glue", 
"character"))))

})
  
