R Under development (unstable) (2025-03-09 r87914 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(datapackage) > > source("helpers.R") > > r <- new_dataresource(name = "foo") > expect_equal(r, list(name = "foo"), attributes = FALSE) > > expect_error(r <- new_dataresource()) > > r <- new_dataresource( + name = "foo", + title = "foo", + description = c("foo", "bar"), + path = "foo", + format = "foo", + mediatype = "foo", + encoding = "foo", + bytes = 10, + hash = "foo") > expect_equal(r, list( + name = "foo", + title = "foo", + description = "foo\nbar", + path = "foo", + format = "foo", + mediatype = "foo", + encoding = "foo", + bytes = 10, + hash = "foo"), attributes = FALSE) > > expect_error( + r <- new_dataresource( + name = "foo", + format = 10 + ) + ) > expect_error( + r <- new_dataresource( + name = "foo", + mediatype = 10 + ) + ) > expect_error( + r <- new_dataresource( + name = "foo", + encoding = 10 + ) + ) > expect_error( + r <- new_dataresource( + name = "foo", + bytes = 3.4 + ) + ) > expect_error( + r <- new_dataresource( + name = "foo", + hash = 3.4 + ) + ) > > > > proc.time() user system elapsed 0.18 0.06 0.18