diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 4717360..ca0908d 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -83,3 +83,29 @@ test_that( test_combinations(this_list) } ) + +test_that( + "get_short_flags", + { + fruits = c('coconut', 'cherry', 'banana', 'berry') + expect_equal(get_short_flags(fruits), c('c', 'a', 'b', 'd')) + + # Should fail for length > 26 + expect_error( + get_short_flags(c(letters, letters)), + "Can't handle more than 26 loops" + ) + } +) + +test_that( + "vector_as_code", + { + fruits = c('coconut', 'cherry', 'banana', 'berry') + initials = vector_as_code(fruits) + expect_equal( + vector_as_code(fruits), + 'c("coconut", "cherry", "banana", "berry")' + ) + } +)