Skip to content

Commit e0b2131

Browse files
committed
Resolve ktlint errors in tests
1 parent 0d2731a commit e0b2131

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ void testWithHeader() throws IOException {
153153
" ktlint()",
154154
" }",
155155
"}");
156-
setFile("src/main/kotlin/test.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
156+
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
157157
gradleRunner().withArguments("spotlessApply").build();
158-
assertFile("src/main/kotlin/test.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test"));
158+
assertFile("src/main/kotlin/AnObject.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test"));
159159
}
160160

161161
@Test
@@ -173,9 +173,9 @@ void testWithHeaderKtfmt() throws IOException {
173173
" ktfmt()",
174174
" }",
175175
"}");
176-
setFile("src/main/kotlin/test.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
176+
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
177177
gradleRunner().withArguments("spotlessApply").build();
178-
assertFile("src/main/kotlin/test.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeaderKtfmt.test"));
178+
assertFile("src/main/kotlin/AnObject.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeaderKtfmt.test"));
179179
}
180180

181181
@Test
@@ -192,9 +192,9 @@ void testWithCustomHeaderSeparator() throws IOException {
192192
" ktlint()",
193193
" }",
194194
"}");
195-
setFile("src/main/kotlin/test.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
195+
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
196196
gradleRunner().withArguments("spotlessApply").build();
197-
assertFile("src/main/kotlin/test.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test"));
197+
assertFile("src/main/kotlin/AnObject.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test"));
198198
}
199199

200200
@Test
@@ -212,9 +212,9 @@ void testWithCustomHeaderSeparatorKtfmt() throws IOException {
212212
" ktfmt()",
213213
" }",
214214
"}");
215-
setFile("src/main/kotlin/test.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
215+
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
216216
gradleRunner().withArguments("spotlessApply").build();
217-
assertFile("src/main/kotlin/test.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeaderKtfmt.test"));
217+
assertFile("src/main/kotlin/AnObject.kt").hasContent(HEADER + "\n" + getTestResource("kotlin/licenseheader/KotlinCodeWithoutHeaderKtfmt.test"));
218218
}
219219

220220
@Test
@@ -232,13 +232,13 @@ void testWithNonStandardYearSeparator() throws IOException {
232232
" }",
233233
"}");
234234

235-
setFile("src/main/kotlin/test.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader.test");
236-
setFile("src/main/kotlin/test2.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader2.test");
235+
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader.test");
236+
setFile("src/main/kotlin/AnObject2.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader2.test");
237237
gradleRunner().withArguments("spotlessApply").build();
238-
assertFile("src/main/kotlin/test.kt").matches(matcher -> {
238+
assertFile("src/main/kotlin/AnObject.kt").matches(matcher -> {
239239
matcher.startsWith("// License Header 2012, 2014");
240240
});
241-
assertFile("src/main/kotlin/test2.kt").matches(matcher -> {
241+
assertFile("src/main/kotlin/AnObject2.kt").matches(matcher -> {
242242
matcher.startsWith("// License Header 2012, 2014");
243243
});
244244
}
@@ -259,13 +259,13 @@ void testWithNonStandardYearSeparatorKtfmt() throws IOException {
259259
" }",
260260
"}");
261261

262-
setFile("src/main/kotlin/test.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader.test");
263-
setFile("src/main/kotlin/test2.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader2.test");
262+
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader.test");
263+
setFile("src/main/kotlin/AnObject2.kt").toResource("kotlin/licenseheader/KotlinCodeWithMultiYearHeader2.test");
264264
gradleRunner().withArguments("spotlessApply").build();
265-
assertFile("src/main/kotlin/test.kt").matches(matcher -> {
265+
assertFile("src/main/kotlin/AnObject.kt").matches(matcher -> {
266266
matcher.startsWith("// License Header 2012, 2014");
267267
});
268-
assertFile("src/main/kotlin/test2.kt").matches(matcher -> {
268+
assertFile("src/main/kotlin/AnObject2.kt").matches(matcher -> {
269269
matcher.startsWith("// License Header 2012, 2014");
270270
});
271271
}

testlib/src/main/resources/kotlin/licenseheader/KotlinCodeWithMultiYearHeader2.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
@file:JvmName("SomeFileName")
33
package my.test
44

5-
object AnObject
5+
object AnObject2

0 commit comments

Comments
 (0)