ITADN

New lint: recommend `expect_match()` and `expect_no_match()`

#3030Openetiennebacher 创建于 2026-03-21
E
etiennebachercommented
`testthat` has `expect_match()` and `expect_no_match()` to replace `expect_true(grepl(...))` and `expect_false(grepl(...))`: https://testthat.r-lib.org/dev/reference/expect_match.html ``` r library(testthat) expect_true(grepl("a", "abc")) expect_match("abc", "a") expect_true(grepl("^a", "^abc", fixed = TRUE)) expect_match("^abc", "^a", fixed = TRUE) expect_false(grepl("^a", "^abc")) expect_no_match("^abc", "^a") ```
0 条评论