@@ -96,4 +96,104 @@ void testUnindentedVisibilitySpecifierShouldAddIssue() {
9696 .appendDecl (" end;" ))
9797 .verifyIssues ();
9898 }
99+
100+ @ Test
101+ void testIndentedVisibilitySpecifierWithWrappedClassDeclarationShouldNotAddIssue () {
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 testIndentedVisibilitySpecifierWithMisalignedCustomAttributeShouldNotAddIssue () {
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 testIndentedVisibilitySpecifierWithSameLineCustomAttributeShouldNotAddIssue () {
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 testTooIndentedVisibilitySpecifierInVarAnonymousRecordShouldAddIssue () {
146+ CheckVerifier .newVerifier ()
147+ .withCheck (new VisibilityKeywordIndentationCheck ())
148+ .onFile (
149+ new DelphiTestUnitBuilder ()
150+ .appendDecl ("var" )
151+ .appendDecl (" Foo: record" )
152+ .appendDecl (" public // Noncompliant" )
153+ .appendDecl (" procedure Proc;" )
154+ .appendDecl (" end;" ))
155+ .verifyIssues ();
156+ }
157+
158+ @ Test
159+ void testCorrectlyIndentedVisibilitySpecifierInVarAnonymousRecordShouldNotAddIssue () {
160+ CheckVerifier .newVerifier ()
161+ .withCheck (new VisibilityKeywordIndentationCheck ())
162+ .onFile (
163+ new DelphiTestUnitBuilder ()
164+ .appendDecl ("var" )
165+ .appendDecl (" Foo: record" )
166+ .appendDecl (" public" )
167+ .appendDecl (" procedure Proc;" )
168+ .appendDecl (" end;" ))
169+ .verifyNoIssues ();
170+ }
171+
172+ @ Test
173+ void testTooIndentedVisibilitySpecifierInConstAnonymousRecordShouldAddIssue () {
174+ CheckVerifier .newVerifier ()
175+ .withCheck (new VisibilityKeywordIndentationCheck ())
176+ .onFile (
177+ new DelphiTestUnitBuilder ()
178+ .appendDecl ("const" )
179+ .appendDecl (" Foo: record" )
180+ .appendDecl (" public // Noncompliant" )
181+ .appendDecl (" procedure Proc;" )
182+ .appendDecl (" end = ();" ))
183+ .verifyIssues ();
184+ }
185+
186+ @ Test
187+ void testCorrectlyIndentedVisibilitySpecifierInConstAnonymousRecordShouldNotAddIssue () {
188+ CheckVerifier .newVerifier ()
189+ .withCheck (new VisibilityKeywordIndentationCheck ())
190+ .onFile (
191+ new DelphiTestUnitBuilder ()
192+ .appendDecl ("const" )
193+ .appendDecl (" Foo: record" )
194+ .appendDecl (" public" )
195+ .appendDecl (" procedure Proc;" )
196+ .appendDecl (" end = ();" ))
197+ .verifyNoIssues ();
198+ }
99199}
0 commit comments