tests/testthat/test-widths.R

context("widths() function Tests")


test_that("widths() function works as expected.", {
  
  df1 <- mtcars[1:10, c("mpg", "cyl") ]
  
  df1
  
  # Assign widths
  widths(df1) <-   list(mpg = 12, 
                        cyl = 10)
  
  
  # Extract format list
  lst <- widths(df1)
  
  expect_equal(length(lst), 2)
  
  
  # No error
  widths(df1) <- list(mpd = 12)
  
  
  fdata(df1) 
  
  widths(df1)
  
  widths(df1) <- NULL
  expect_equal(length(widths(df1)), 0)
  
  
})

Try the fmtr package in your browser

Any scripts or data that you put into this service are public.

fmtr documentation built on April 4, 2025, 1:36 a.m.