Skip to content

Commit

Permalink
test for no suggestion when no match is found
Browse files Browse the repository at this point in the history
  • Loading branch information
advieser committed Oct 2, 2024
1 parent ae4b5e4 commit aa8a0d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test_Dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ test_that("similar entries in other dictionaries", {
d_lookup1 = Dictionary$new()
d_lookup1$add("cde", obj)

# Makes suggestions
expect_error(dictionary_sugar_get(d, "cde", .dicts_suggest = list("lookup1" = d_lookup1)), "Similar entries in other dictionaries")
# Makes no suggestsions
expect_error(dictionary_sugar_get(d, "xyz", .dicts_suggest = list("lookup1" = d_lookup1)), "(?!(Similar entries in other dictionaries))", perl = TRUE)

d_lookup2 = Dictionary$new()
d_lookup2$add("bcd", obj)

# Dictionaries ordered by closest match per dictionary
expect_error(
dictionary_sugar_get(d, "cde", .dicts_suggest = list("lookup1" = d_lookup1, "lookup2" = d_lookup2)),
"Similar entries in other dictionaries.*lookup1.*lookup2"
)
expect_error(dictionary_sugar_get(d, "bcd", .dicts_suggest = list("lookup1" = d_lookup1, "lookup2" = d_lookup2)), "Similar entries in other dictionaries.*lookup2.*lookup1")
})

0 comments on commit aa8a0d2

Please sign in to comment.