File: test-cast.R

package info (click to toggle)
r-cran-blob 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 180 kB
  • sloc: sh: 13; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 810 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
context("test-cast")

test_that("casting with as.blob()", {
  # Deprecated in v1.2.0
  scoped_lifecycle_silence()

  expect_identical(as.blob(blob(raw(1))), blob(raw(1)))
  expect_identical(as.blob(list(raw(1))), blob(raw(1)))
  expect_identical(as.blob(raw(1)), blob(raw(1)))
  expect_identical(as.blob(1:3), blob(as.raw(1), as.raw(2), as.raw(3)))
  expect_identical(as.blob(c("abc", "def")), blob(charToRaw("abc"), charToRaw("def")))
})

test_that("casting with as_blob()", {
  expect_identical(as_blob(blob(raw(1))), blob(raw(1)))
  expect_identical(as_blob(list(raw(1))), blob(raw(1)))
  expect_identical(as_blob(raw(1)), blob(raw(1)))
  expect_identical(blob(!!!as.raw(1:3)), blob(as.raw(1), as.raw(2), as.raw(3)))
  expect_identical(as_blob(c("abc", "def")), blob(charToRaw("abc"), charToRaw("def")))
})