tests/testthat/test-dbinfo.R

test_that("dbGetInfo returns something meaningful", {
  dbdir <- path_normalize(tempfile())
  drv <- duckdb(dbdir)

  info_drv <- dbGetInfo(drv)
  expect_equal(info_drv$dbname, dbdir)
  expect_true(grepl("\\d+\\.\\d+\\.\\d+", info_drv$client.version))
  expect_true(grepl("\\d+\\.\\d+\\.\\d+", info_drv$driver.version))

  con <- dbConnect(drv)
  on.exit(dbDisconnect(con, shutdown = TRUE))
  info_con <- dbGetInfo(con)
  expect_equal(info_con$dbname, dbdir)
  expect_true(grepl("\\d+\\.\\d+\\.\\d+", info_con$db.version))
})

Try the duckdb package in your browser

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

duckdb documentation built on Oct. 30, 2024, 5:06 p.m.