-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write test cases for all suppression levels - #6
- Loading branch information
1 parent
1e01f62
commit 44cf09f
Showing
5 changed files
with
116 additions
and
2 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
2 changes: 2 additions & 0 deletions
2
.../src/test/resources/SuppressedElements.kt → ...esources/SuppressedByElementAnnotation.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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@file:Suppress("unused") | ||
|
||
/** | ||
* @author Artur Bosch | ||
*/ | ||
|
42 changes: 42 additions & 0 deletions
42
detekt-rules/src/test/resources/SuppressedElementsByClassAnnotation.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,42 @@ | ||
/** | ||
* @author Artur Bosch | ||
*/ | ||
@Suppress("unused", "LongMethod", "LongParameterList", "ComplexCondition") | ||
class SuppressedElements3 { | ||
|
||
fun lpl(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) = (a + b + c + d + e + f).apply { | ||
assert(false) { "FAILED TEST" } | ||
} | ||
|
||
fun cc() { | ||
if (this is SuppressedElements3 && this !is Any && this is Nothing && this is SuppressedElements3) { | ||
assert(false) { "FAIL" } | ||
} | ||
} | ||
|
||
fun lm() { | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
assert(false) { "FAILED TEST" } | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
detekt-rules/src/test/resources/SuppressedElementsByFileAnnotation.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,48 @@ | ||
@file:Suppress("unused", "LongMethod", "LongParameterList", "ComplexCondition") | ||
|
||
/** | ||
* @author Artur Bosch | ||
*/ | ||
|
||
fun lpl2(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) = (a + b + c + d + e + f).apply { | ||
assert(false) { "FAILED TEST" } | ||
} | ||
|
||
class SuppressedElements2 { | ||
|
||
fun lpl(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) = (a + b + c + d + e + f).apply { | ||
assert(false) { "FAILED TEST" } | ||
} | ||
|
||
fun cc() { | ||
if (this is SuppressedElements2 && this !is Any && this is Nothing && this is SuppressedElements2) { | ||
assert(false) { "FAIL" } | ||
} | ||
} | ||
|
||
fun lm() { | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
lpl(1, 2, 3, 4, 5, 6) | ||
assert(false) { "FAILED TEST" } | ||
} | ||
|
||
} |