File: test_setValue.R

package info (click to toggle)
r-cran-bbmisc 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,256 kB
  • sloc: ansic: 176; sh: 9; makefile: 5
file content (11 lines) | stat: -rw-r--r-- 394 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
context("setValue")

test_that("setValue", {
  xs1 = list(a=1, b=2)
  expect_equal(setValue(xs1, "b", 3), list(a=1, b=3))
  expect_equal(setValue(xs1, "b", NULL), list(a=1, b=NULL))
  expect_equal(setValue(xs1, "c", 3), list(a=1, b=2, c=3))
  expect_equal(setValue(xs1, c("a","b"), as.list(4:5)), list(a=4, b=5))
  expect_equal(setValue(xs1, c("b","c"), as.list(4:5)), list(a=1, b=4, c=5))
})