Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Aug 3, 2022
1 parent 3bc81d2 commit b5f2981
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ class AnalyzerSpec {
val settings = createProcessingSettings(testFile, yamlConfig("configs/config-value-type-correct.yml"))
val analyzer = Analyzer(settings, listOf(StyleRuleSetProvider()), emptyList())

assertThat(settings.use { analyzer.run(listOf(compileForTest(testFile))) }).isEmpty()
assertThat(settings.use { analyzer.run(listOf(compileForTest(testFile))) }.values.flatten()).isEmpty()
}

@Test
fun `with findings`() {
val testFile = path.resolve("Test.kt")
val settings = createProcessingSettings(testFile, yamlConfig("configs/config-value-type-correct.yml"))
val analyzer = Analyzer(settings, listOf(StyleRuleSetProvider(18)), emptyList())
val analyzer = Analyzer(settings, listOf(StyleRuleSetProvider(30)), emptyList())

assertThat(settings.use { analyzer.run(listOf(compileForTest(testFile))) }).hasSize(1)
assertThat(settings.use { analyzer.run(listOf(compileForTest(testFile))) }.values.flatten()).hasSize(1)
}

@Test
Expand All @@ -84,7 +84,7 @@ class AnalyzerSpec {
)
val analyzer = Analyzer(settings, listOf(StyleRuleSetProvider(18)), emptyList())

assertThat(settings.use { analyzer.run(listOf(compileForTest(testFile))) }).isEmpty()
assertThat(settings.use { analyzer.run(listOf(compileForTest(testFile))) }.values.flatten()).isEmpty()
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion detekt-core/src/test/resources/cases/Test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package cases
@Suppress("Unused")
class Test

@Target(AnnotationTarget.FILE)
@Target(AnnotationTarget.FILE, AnnotationTarget.FUNCTION)
annotation class AnAnnotation

0 comments on commit b5f2981

Please sign in to comment.