Skip to content

Commit 4503782

Browse files
add core test
1 parent 6be527b commit 4503782

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ public void behavior() throws Exception {
3838
});
3939
}
4040

41+
@Test
42+
public void worksShyiko() throws Exception {
43+
// Must use jcenter because `com.andreapivetta.kolor:kolor:0.0.2` isn't available on mavenCentral.
44+
// It is a dependency of ktlint.
45+
FormatterStep step = KtLintStep.create("0.31.0", TestProvisioner.jcenter());
46+
StepHarness.forStep(step)
47+
.testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean")
48+
.testException("kotlin/ktlint/unsolvable.dirty", assertion -> {
49+
assertion.isInstanceOf(AssertionError.class);
50+
assertion.hasMessage("Error on line: 1, column: 1\n" +
51+
"Wildcard import");
52+
});
53+
}
54+
55+
@Test
56+
public void worksPinterest() throws Exception {
57+
// Must use jcenter because `com.andreapivetta.kolor:kolor:0.0.2` isn't available on mavenCentral.
58+
// It is a dependency of ktlint.
59+
FormatterStep step = KtLintStep.create("0.32.0", TestProvisioner.jcenter());
60+
StepHarness.forStep(step)
61+
.testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean")
62+
.testException("kotlin/ktlint/unsolvable.dirty", assertion -> {
63+
assertion.isInstanceOf(AssertionError.class);
64+
assertion.hasMessage("Error on line: 1, column: 1\n" +
65+
"Wildcard import");
66+
});
67+
}
68+
4169
@Test
4270
public void equality() throws Exception {
4371
new SerializableEqualityTester() {

0 commit comments

Comments
 (0)