File: test-backend-hana.R

package info (click to toggle)
r-cran-dbplyr 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,376 kB
  • sloc: sh: 13; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 772 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
test_that("custom string translations", {
  local_con(simulate_hana())

  expect_snapshot(translate_sql(paste0("a", "b")))
  expect_snapshot(translate_sql(paste("a", "b")))

  expect_snapshot(translate_sql(substr(x, 2, 4)))
  expect_snapshot(translate_sql(substring(x, 2, 4)))
  expect_snapshot(translate_sql(str_sub(x, 2, -2)))
})

test_that("copy_inline uses UNION ALL", {
  con <- simulate_hana()
  y <- tibble::tibble(id = 1L, arr = "{1,2,3}")

  types <- c(id = "bigint", arr = "integer[]")
  expect_snapshot({
    copy_inline(con, y %>% slice(0)) %>% remote_query()
    copy_inline(con, y) %>% remote_query()

    # with `types`
    copy_inline(con, y %>% slice(0), types = types) %>% remote_query()
    copy_inline(con, y, types = types) %>% remote_query()
  })
})