tests/testthat/test-mc_head.R

test_that("mc_head works", {
  skip_if_offline()
  skip_on_cran()
  Sys.setenv("R_USER_DATA_DIR"=tempdir())
  install_mc()
  
  tf <- tempfile()
  write.csv(faithful, tf, row.names = FALSE)
  on.exit(unlink(tf))
  
  mc_mb("play/faithful", verbose = FALSE)
  mc_cp(tf, "play/faithful/faithful.csv")
  
  response <- mc_head("play/faithful/faithful.csv", 6)
  faithful <- read.csv(textConnection(response))
  has_content <- nrow(faithful) == (6 - 1) # header row
  
  expect_true(has_content)
})

Try the minioclient package in your browser

Any scripts or data that you put into this service are public.

minioclient documentation built on Nov. 7, 2023, 5:07 p.m.