Skip to content

Commit

Permalink
account for the presence of numeric values in a vector of characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Karim-Mane authored and bahadzie committed Apr 8, 2024
1 parent 8317b2f commit 6645e34
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/test-numberize.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})

0 comments on commit 6645e34

Please sign in to comment.