update test expectations (#3903)

diff --git a/lib/src/warnings.dart b/lib/src/warnings.dart
index 4e56905..15d0ade 100644
--- a/lib/src/warnings.dart
+++ b/lib/src/warnings.dart
@@ -540,15 +540,17 @@
   bool get hasWarnings => _countedWarnings.isNotEmpty;
 
   /// Whether we've already warned for this combination of [element], [kind],
-  /// and [message].
-  bool hasWarning(Warnable? element, PackageWarning kind, String message) {
+  /// and [messageFragment].
+  bool hasWarning(
+      Warnable? element, PackageWarning kind, String messageFragment) {
     if (element == null) {
       return false;
     }
     final warning = _countedWarnings[element.element];
     if (warning != null) {
       final messages = warning[kind];
-      return messages != null && messages.contains(message);
+      return messages != null &&
+          messages.any((message) => message.contains(messageFragment));
     }
     return false;
   }
diff --git a/test/documentation_comment_test.dart b/test/documentation_comment_test.dart
index e9701a1..dceba66 100644
--- a/test/documentation_comment_test.dart
+++ b/test/documentation_comment_test.dart
@@ -451,8 +451,7 @@
       libraryModel,
       hasInvalidParameterWarning(
           'The {@animation ...} directive was called with invalid '
-          'parameters. FormatException: Could not find an option named '
-          '"name".'),
+          'parameters. FormatException: Could not find an option named'),
     );
   }