-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What's done: * Provide fix logic * Add tests
- Loading branch information
1 parent
eb65634
commit fbe1146
Showing
8 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...rules/src/test/kotlin/com/saveourtool/diktat/ruleset/chapter3/PreviewAnnotationFixTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.saveourtool.diktat.ruleset.chapter3 | ||
|
||
import com.saveourtool.diktat.ruleset.rules.chapter3.PreviewAnnotationRule | ||
import com.saveourtool.diktat.util.FixTestBase | ||
|
||
import generated.WarningNames | ||
import org.junit.jupiter.api.Tag | ||
import org.junit.jupiter.api.Test | ||
|
||
class PreviewAnnotationFixTest : FixTestBase("test/paragraph3/preview_annotation", ::PreviewAnnotationRule) { | ||
@Test | ||
@Tag(WarningNames.PREVIEW_ANNOTATION) | ||
fun `should add private modifier`() { | ||
fixAndCompare("PreviewAnnotationPrivateModifierExpected.kt", "PreviewAnnotationPrivateModifierTest.kt") | ||
} | ||
|
||
@Test | ||
@Tag(WarningNames.PREVIEW_ANNOTATION) | ||
fun `should add Preview suffix`() { | ||
fixAndCompare("PreviewAnnotationMethodNameExpected.kt", "PreviewAnnotationMethodNameTest.kt") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
.../test/resources/test/paragraph3/preview_annotation/PreviewAnnotationMethodNameExpected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package test.paragraph3.preview_annotation | ||
|
||
@Preview | ||
private fun BannerPreview() {} |
4 changes: 4 additions & 0 deletions
4
.../src/test/resources/test/paragraph3/preview_annotation/PreviewAnnotationMethodNameTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package test.paragraph3.preview_annotation | ||
|
||
@Preview | ||
private fun Banner() {} |
20 changes: 20 additions & 0 deletions
20
.../resources/test/paragraph3/preview_annotation/PreviewAnnotationPrivateModifierExpected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package test.paragraph3.preview_annotation | ||
|
||
@Preview | ||
@Composable | ||
private fun BannerPreview1() {} | ||
|
||
@Preview | ||
private fun BannerPreview2() {} | ||
|
||
@Preview | ||
private fun BannerPreview3() {} | ||
|
||
@Preview | ||
private fun BannerPreview4() {} | ||
|
||
@Preview | ||
private fun BannerPreview5() {} | ||
|
||
@Preview | ||
final private fun BannerPreview6() {} |
20 changes: 20 additions & 0 deletions
20
...test/resources/test/paragraph3/preview_annotation/PreviewAnnotationPrivateModifierTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package test.paragraph3.preview_annotation | ||
|
||
@Preview | ||
@Composable | ||
public fun BannerPreview1() {} | ||
|
||
@Preview | ||
protected fun BannerPreview2() {} | ||
|
||
@Preview | ||
internal fun BannerPreview3() {} | ||
|
||
@Preview | ||
fun BannerPreview4() {} | ||
|
||
@Preview | ||
open fun BannerPreview5() {} | ||
|
||
@Preview | ||
final fun BannerPreview6() {} |