Skip to content

Commit 8b4d03e

Browse files
authored
Add test for dot shorthands in constant initializers (#4093)
1 parent e20f1be commit 8b4d03e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/dot_shorthands_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,18 @@ void m(){}
114114

115115
expect(m.hasAnnotations, true);
116116
}
117+
118+
void test_doc_dot_shorthand_const_init_success() async {
119+
// Constant initializers are not linked so this test is just to make sure we
120+
// don't crash.
121+
var library = await bootPackageWithLibrary('''
122+
enum Color {
123+
red, green
124+
}
125+
const Color favColor = .green;
126+
''');
127+
var m = library.constants.named('favColor');
128+
129+
expect(m.hasDocumentation, false);
130+
}
117131
}

0 commit comments

Comments
 (0)