@@ -34,7 +34,7 @@ class VisibilityKeywordIndentationCheckTest {
3434 "class helper for TObject" ,
3535 "record helper for string"
3636 })
37- void testTooIndentedVisibilitySpecifierShouldAddIssue (String structType ) {
37+ void testVisibilityWithTooMuchIndentationShouldAddIssue (String structType ) {
3838 CheckVerifier .newVerifier ()
3939 .withCheck (new VisibilityKeywordIndentationCheck ())
4040 .onFile (
@@ -56,7 +56,7 @@ void testTooIndentedVisibilitySpecifierShouldAddIssue(String structType) {
5656 "class helper for TObject" ,
5757 "record helper for string"
5858 })
59- void testCorrectlyIndentedVisibilitySpecifierShouldNotAddIssue (String structType ) {
59+ void testVisibilityAnchoredToTypeDeclarationShouldNotAddIssue (String structType ) {
6060 CheckVerifier .newVerifier ()
6161 .withCheck (new VisibilityKeywordIndentationCheck ())
6262 .onFile (
@@ -70,7 +70,7 @@ void testCorrectlyIndentedVisibilitySpecifierShouldNotAddIssue(String structType
7070 }
7171
7272 @ Test
73- void testImplicitPublishedVisibilitySectionShouldNotAddIssue () {
73+ void testImplicitPublishedVisibilityShouldNotAddIssue () {
7474 CheckVerifier .newVerifier ()
7575 .withCheck (new VisibilityKeywordIndentationCheck ())
7676 .onFile (
@@ -84,7 +84,7 @@ void testImplicitPublishedVisibilitySectionShouldNotAddIssue() {
8484 }
8585
8686 @ Test
87- void testUnindentedVisibilitySpecifierShouldAddIssue () {
87+ void testVisibilityAtMarginShouldAddIssue () {
8888 CheckVerifier .newVerifier ()
8989 .withCheck (new VisibilityKeywordIndentationCheck ())
9090 .onFile (
@@ -96,4 +96,78 @@ void testUnindentedVisibilitySpecifierShouldAddIssue() {
9696 .appendDecl (" end;" ))
9797 .verifyIssues ();
9898 }
99+
100+ @ Test
101+ void testWrappedClassDeclarationShouldNotAddIssue () {
102+ CheckVerifier .newVerifier ()
103+ .withCheck (new VisibilityKeywordIndentationCheck ())
104+ .onFile (
105+ new DelphiTestUnitBuilder ()
106+ .appendDecl ("type" )
107+ .appendDecl (" TFoo =" )
108+ .appendDecl (" class(TObject)" )
109+ .appendDecl (" private" )
110+ .appendDecl (" procedure Proc;" )
111+ .appendDecl (" end;" ))
112+ .verifyNoIssues ();
113+ }
114+
115+ @ Test
116+ void testMisalignedCustomAttributeShouldNotAddIssue () {
117+ CheckVerifier .newVerifier ()
118+ .withCheck (new VisibilityKeywordIndentationCheck ())
119+ .onFile (
120+ new DelphiTestUnitBuilder ()
121+ .appendDecl ("type" )
122+ .appendDecl (" [Foo]" )
123+ .appendDecl (" TBar = class(TObject)" )
124+ .appendDecl (" private" )
125+ .appendDecl (" procedure Baz;" )
126+ .appendDecl (" end;" ))
127+ .verifyNoIssues ();
128+ }
129+
130+ @ Test
131+ void testSameLineCustomAttributeShouldNotAddIssue () {
132+ CheckVerifier .newVerifier ()
133+ .withCheck (new VisibilityKeywordIndentationCheck ())
134+ .onFile (
135+ new DelphiTestUnitBuilder ()
136+ .appendDecl ("type" )
137+ .appendDecl (" [Foo] TBar = class(TObject)" )
138+ .appendDecl (" private" )
139+ .appendDecl (" procedure Baz;" )
140+ .appendDecl (" end;" ))
141+ .verifyNoIssues ();
142+ }
143+
144+ @ Test
145+ void testVarAnonymousRecordShouldNotAddIssue () {
146+ CheckVerifier .newVerifier ()
147+ .withCheck (new VisibilityKeywordIndentationCheck ())
148+ .onFile (
149+ new DelphiTestUnitBuilder ()
150+ .appendDecl ("var" )
151+ .appendDecl (" Foo: record" )
152+ .appendDecl (" public" )
153+ .appendDecl (" public" )
154+ .appendDecl (" Bar: Integer;" )
155+ .appendDecl (" end;" ))
156+ .verifyNoIssues ();
157+ }
158+
159+ @ Test
160+ void testConstAnonymousRecordShouldNotAddIssue () {
161+ CheckVerifier .newVerifier ()
162+ .withCheck (new VisibilityKeywordIndentationCheck ())
163+ .onFile (
164+ new DelphiTestUnitBuilder ()
165+ .appendDecl ("const" )
166+ .appendDecl (" Foo: record" )
167+ .appendDecl (" public" )
168+ .appendDecl (" public" )
169+ .appendDecl (" Bar: Integer;" )
170+ .appendDecl (" end = ();" ))
171+ .verifyNoIssues ();
172+ }
99173}
0 commit comments