Skip to content

Commit

Permalink
Merge pull request #431 from r-dbi/f-dbitest
Browse files Browse the repository at this point in the history
test: Run DBItest for SQLite as part of the checks here
  • Loading branch information
aviator-app[bot] authored Dec 16, 2023
2 parents 48fd25e + 57fec83 commit c47fb21
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ inst\/doc\/DBI\.b..$
^CRAN-SUBMISSION$
^R/zzz\.R$
^\.aviator/config\.yml$
^tests/testthat/helper-dev\.R$
17 changes: 17 additions & 0 deletions tests/testthat/helper-dev.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if (dir.exists("../../../RSQLite")) {
writeLines(
c(
"# Generated by helper-dev.R, do not edit by hand",
"",
"skip_if_not_installed(\"RSQLite\")",
"skip_if_not_installed(\"nanoarrow\")",
"",
"# helper-DBItest.R",
readLines("../../../RSQLite/tests/testthat/helper-DBItest.R"),
"",
"# test-DBItest.R",
readLines("../../../RSQLite/tests/testthat/test-DBItest.R")
),
"test-DBItest.R"
)
}
36 changes: 36 additions & 0 deletions tests/testthat/test-DBItest.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by helper-dev.R, do not edit by hand

skip_if_not_installed("RSQLite")
skip_if_not_installed("nanoarrow")

# helper-DBItest.R
# Also copied into DBI
tryCatch(skip = function(e) message(conditionMessage(e)), {
skip_on_cran()
skip_if_not_installed("DBItest")

DBItest::make_context(
RSQLite::SQLite(),
list(dbname = tempfile("DBItest", fileext = ".sqlite")),
tweaks = DBItest::tweaks(
dbitest_version = "1.7.2",
constructor_relax_args = TRUE,
placeholder_pattern = c("?", "$1", "$name", ":name"),
date_cast = function(x) paste0("'", x, "'"),
time_cast = function(x) paste0("'", x, "'"),
timestamp_cast = function(x) paste0("'", x, "'"),
logical_return = function(x) as.integer(x),
date_typed = FALSE,
time_typed = FALSE,
timestamp_typed = FALSE
),
name = "RSQLite"
)
})

# test-DBItest.R
# Also copied into DBI
skip_on_cran()
skip_if_not_installed("DBItest")

DBItest::test_all()

0 comments on commit c47fb21

Please sign in to comment.