From aa8a0d21ddeff432bbe7ce71c26fef11a1ad2a14 Mon Sep 17 00:00:00 2001 From: kenomersmannPC Date: Wed, 2 Oct 2024 13:26:55 +0200 Subject: [PATCH] test for no suggestion when no match is found --- tests/testthat/test_Dictionary.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test_Dictionary.R b/tests/testthat/test_Dictionary.R index d8f0fe95..d600faa9 100644 --- a/tests/testthat/test_Dictionary.R +++ b/tests/testthat/test_Dictionary.R @@ -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") })