From 6645e3491988643ac895f358ab0b6041b2b858d9 Mon Sep 17 00:00:00 2001 From: Karim-Mane Date: Mon, 8 Apr 2024 12:21:04 +0000 Subject: [PATCH] account for the presence of numeric values in a vector of characters --- tests/testthat/test-numberize.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/testthat/test-numberize.R b/tests/testthat/test-numberize.R index e0deec5..7cd71e0 100644 --- a/tests/testthat/test-numberize.R +++ b/tests/testthat/test-numberize.R @@ -88,3 +88,11 @@ test_that("non digit word returns NA", { res <- numberize("epiverse", lang = "en") expect_true(is.na(res)) }) + +test_that("vector with number and words and NA is properly handled", { + res <- numberize( + c(17, "dix", "soixante-cinq", "deux mille vingt-quatre", NA), + lang = "fr" + ) + expect_identical(res, c(17, 10, 65, 2024, NA)) +})