Skip to content

Commit 8a9585a

Browse files
committed
add test for static method dot shorthand
1 parent 28ca645 commit 8a9585a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/dot_shorthands_test.dart

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4+
import 'package:analyzer/dart/ast/ast.dart';
45
import 'package:test/test.dart';
56
import 'package:test_reflective_loader/test_reflective_loader.dart';
67

@@ -40,7 +41,7 @@ class C {
4041
);
4142
}
4243

43-
void test_doc_dot_shorthand_method_invocation_success() async {
44+
void test_doc_dot_shorthand_constructor_invocation_success() async {
4445
var library = await bootPackageWithLibrary('''
4546
class C {
4647
/// Cannot link [.c()]
@@ -57,4 +58,23 @@ class C {
5758
'<p>Cannot link <code>.c()</code></p>',
5859
);
5960
}
61+
62+
void test_doc_dot_shorthand_method_invocation_success() async {
63+
var library = await bootPackageWithLibrary('''
64+
class C {
65+
/// Cannot link [.f()]
66+
void m(String p) {}
67+
68+
69+
static C f() => C();
70+
}
71+
''');
72+
var m = library.classes.named('C').instanceMethods.named('m');
73+
74+
expect(m.hasDocumentationComment, true);
75+
expect(
76+
m.documentationAsHtml,
77+
'<p>Cannot link <code>.f()</code></p>',
78+
);
79+
}
6080
}

0 commit comments

Comments
 (0)