tests/testthat/test_xmu_match.arg.r

# library(testthat)
# library(umx)
# test_file("~/bin/umx/tests/testthat/test_xmu_match.arg.r") 
# 
# test_package("umx")

test_that("testing xmu_match.arg", {
	oList = c("a", "b", "c")
	expect_match(xmu_match.arg(oList, oList), "a")	
	expect_match(xmu_match.arg("b", oList), "b")
	expect_error(xmu_match.arg("bad", oList))
	expect_match(xmu_match.arg("allow me", oList, check = FALSE), "allow me")
	
	# fails with NULL!!!!!
	# oList = c(NULL, "b", "c")
	# xmu_match.arg(oList, oList)
	
	oList = c(NA, "b", "c")
	# use NA instead
	oList = c(TRUE, FALSE, NA)
	expect_true(xmu_match.arg(TRUE, oList), TRUE)
})

Try the umx package in your browser

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

umx documentation built on Nov. 17, 2023, 1:07 a.m.