File: test-data-type.R

package info (click to toggle)
dbi 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,740 kB
  • sloc: makefile: 2
file content (18 lines) | stat: -rw-r--r-- 531 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
test_that("dbDataType works on a data frame", {
  df <- data.frame(x = 1:10, y = runif(10))
  types <- dbDataType(MockDriver(), df)

  expect_equal(types, c(x = "INT", y = "DOUBLE"))
})

test_that("dbDataType works on AsIs", {
  drv <- MockDriver()

  int_value <- 1L
  expect_equal(dbDataType(drv, int_value), "INT")
  expect_equal(dbDataType(drv, I(int_value)), "INT")

  date_value <- structure(17455, class = "Date")
  expect_equal(dbDataType(drv, date_value), "DATE")
  expect_equal(dbDataType(drv, I(date_value)), "DATE")
})