tests/testthat/test.Storage.R

test_that("redland library loads", {
    library(redland)
    # Add a line to this test to prevent 'Empty test' (skipped) msg.
    expect_true(require(redland))
})
test_that("Storage constructor", {
    library(redland)
    world <- new("World")
    expect_false(is.null(world))
    
    # Test creating the Storage system
    storage <- new("Storage", world, "hashes", name="", options="hash-type='memory'")
    expect_false(is.null(storage))
    expect_match(class(storage@librdf_storage), "_p_librdf_storage_s")
    
    # Test that storage creation fails if world is not provided or is null
    err <- try(storage <- new("Storage", world=NULL, "hashes", name="", options="hash-type='memory'"), silent=TRUE)
    expect_match(class(err), "try-error")
    
    # Test that storage creation succeeds even if type and related options are not provided (use defaults)
    err <- try(storage <- new("Storage", world=world), silent=TRUE)
    expect_match(class(err), "Storage")
    
})

Try the redland package in your browser

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

redland documentation built on May 31, 2023, 6:32 p.m.