From 97bdafcfd460f5af435a6c6ad46886a045b19ccf Mon Sep 17 00:00:00 2001 From: Sarah Zakarias Date: Mon, 25 Aug 2025 09:59:22 +0000 Subject: [PATCH] Add tests for dot shorthands in annotations and default values --- test/dot_shorthands_test.dart | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/dot_shorthands_test.dart b/test/dot_shorthands_test.dart index 0a92dd91c5..5b236cb719 100644 --- a/test/dot_shorthands_test.dart +++ b/test/dot_shorthands_test.dart @@ -76,4 +76,42 @@ class C { '

Cannot link .f()

', ); } + + void test_doc_dot_shorthand_default_values_success() async { + // For now parameter default values are not linked so this test is just to + // make sure we don't crash. + var library = await bootPackageWithLibrary(''' +enum Color { + red, green +} + +class C { + void m({Color c = .red}) {} +} +'''); + var m = library.classes.named('C').instanceMethods.named('m'); + + expect(m.hasDocumentationComment, false); + } + + void test_doc_dot_shorthand_annotation_success() async { + // For now parameters in annotations are not linked so this test is just to + // make sure we don't crash. + var library = await bootPackageWithLibrary(''' +enum Color { + red, green +} + +class C { + final Color c; + const C(this.c); +} + +@C(.red) +void m(){} +'''); + var m = library.functions.named('m'); + + expect(m.hasAnnotations, true); + } }