1

test_that() または expect_XXX() 呼び出しで否定的な条件を書くことは可能ですか? 具体的には、部分文字列を含まない文字列をテストしたいので、次のようにします。

expect_that("Apples, Oranges, Banana", !matches('Onion'))

また

expect_not_match("Apples, Oranges, Banana", 'Onion')

たとえばgrepと組み合わせてexpect_true()を使用できることを認識しています:

expect_true(length(grep("Onion", "Apples, Oranges, Banana")) == 0)

しかし、それはあまり読めないようです。

4

1 に答える 1