Skip to content

Commit 97bdafc

Browse files
committed
Add tests for dot shorthands in annotations and default values
1 parent 64e4647 commit 97bdafc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/dot_shorthands_test.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,42 @@ class C {
7676
'<p>Cannot link <code>.f()</code></p>',
7777
);
7878
}
79+
80+
void test_doc_dot_shorthand_default_values_success() async {
81+
// For now parameter default values are not linked so this test is just to
82+
// make sure we don't crash.
83+
var library = await bootPackageWithLibrary('''
84+
enum Color {
85+
red, green
86+
}
87+
88+
class C {
89+
void m({Color c = .red}) {}
90+
}
91+
''');
92+
var m = library.classes.named('C').instanceMethods.named('m');
93+
94+
expect(m.hasDocumentationComment, false);
95+
}
96+
97+
void test_doc_dot_shorthand_annotation_success() async {
98+
// For now parameters in annotations are not linked so this test is just to
99+
// make sure we don't crash.
100+
var library = await bootPackageWithLibrary('''
101+
enum Color {
102+
red, green
103+
}
104+
105+
class C {
106+
final Color c;
107+
const C(this.c);
108+
}
109+
110+
@C(.red)
111+
void m(){}
112+
''');
113+
var m = library.functions.named('m');
114+
115+
expect(m.hasAnnotations, true);
116+
}
79117
}

0 commit comments

Comments
 (0)