R version 4.5.0 beta (2025-04-01 r88091 ucrt) -- "How About a Twenty-Six" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(testthat) > library(countrows) > library(data.table) > > test_that("count_rows_with_pattern handles valid input", { + df <- data.frame(text = c("apple", "banana", "apple pie", "orange")) + expect_equal(count_rows_with_pattern("apple", data = df), 2L) + expect_equal(count_rows_with_pattern("APPLE", data = df, ignore_case = TRUE), 2L) + expect_equal(count_rows_with_pattern("grape", data = df), 0L) + expect_equal(count_rows_with_pattern("^apple", data = df), 1L) + }) ── Failure: count_rows_with_pattern handles valid input ──────────────────────── count_rows_with_pattern("apple", data = df) not equal to 2L. 1/1 mismatches [1] 0 - 2 == -2 ── Failure: count_rows_with_pattern handles valid input ──────────────────────── count_rows_with_pattern("APPLE", data = df, ignore_case = TRUE) not equal to 2L. 1/1 mismatches [1] 0 - 2 == -2 ── Failure: count_rows_with_pattern handles valid input ──────────────────────── count_rows_with_pattern("^apple", data = df) not equal to 1L. 1/1 mismatches [1] 0 - 1 == -1 Error: ! Test failed Backtrace: ▆ 1. ├─testthat::test_that(...) 2. │ └─withr (local) ``() 3. └─reporter$stop_if_needed() 4. └─rlang::abort("Test failed", call = NULL) Execution halted