Skip to content

Commit

Permalink
Add a few more trivial unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bodkan committed Oct 10, 2024
1 parent 45baed7 commit 583f9a2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/testthat/test-runners.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,24 @@ test_that("if `path =` is given, msprime returns it back and saves a tree-sequen
ts <- ts_load(file = ts_path, model)
expect_equal(ts_nodes(ts), ts_nodes(result2))
})

test_that("SLiMgui does not start in an interactive session", {
skip_if(interactive())
expect_error(slim(model, sequence_length = 1, recombination_rate = 0),
"SLiMgui can only be run from an interactive R session")
})

test_that("slendr model directory must be present", {
broken_model <- model
broken_model$path <- "nope"
expect_error(slim(broken_model, sequence_length = 1, recombination_rate = 0),
"Model directory 'nope' does not exist")
})

test_that("slendr model directory must be present", {
broken_path <- "nope"
expect_error(
slim(model, sequence_length = 1, recombination_rate = 0, slim_path = broken_path),
paste0("SLiM binary not found at ", broken_path)
)
})

0 comments on commit 583f9a2

Please sign in to comment.