tests/testthat/test-select.R

library(yspec)
library(testthat)

context("test-select")

test_that("select column subset [YSP-TEST-0084]", {
  spec <- ys_help$spec()
  # spec2 <- ys_select(spec)
  # expect_identical(spec,spec2)
  spec3 <- ys_select(spec, WT, AGE, ALB)
  expect_identical(names(spec3), c("WT", "AGE", "ALB"))
  expect_is(spec3, "yspec")
  expect_error(ys_select(spec, kyle))
})

test_that("select with no matching names returns zero-length yspec [YSP-TEST-0085]", {
  spec <- ys_help$spec()
  spec <- ys_select(spec, character(0))
  expect_length(spec, 0)
  expect_is(spec, "yspec")
  m <- get_meta(spec)
  expect_is(m, "list")
  expect_true(length(m) > 0)
})
metrumresearchgroup/yspec documentation built on May 24, 2024, 12:48 a.m.