-
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.
Added test class for DummyWarning (#810)
* Added test class for DummyWarning ### What's done: * Added test class for DummyWarning, which shows the general form of how to test your rule * Add newline in guide-chapter-1, since table wasn't displayed
- Loading branch information
1 parent
ee33cfd
commit 9a2a218
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/dummy/DummyWarningWarnTest.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,31 @@ | ||
package org.cqfn.diktat.ruleset.dummy | ||
|
||
import org.cqfn.diktat.ruleset.constants.Warnings.DUMMY_TEST_WARNING | ||
import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID | ||
import org.cqfn.diktat.util.LintTestBase | ||
|
||
import com.pinterest.ktlint.core.LintError | ||
import generated.WarningNames | ||
import org.junit.jupiter.api.Disabled | ||
import org.junit.jupiter.api.Tag | ||
import org.junit.jupiter.api.Test | ||
|
||
/** | ||
* In this class you can test the logic of your rule, which should be implemented in DummyWarning | ||
*/ | ||
class DummyWarningWarnTest : LintTestBase(::DummyWarning) { | ||
private val ruleId = "$DIKTAT_RULE_SET_ID:dummy-rule" | ||
|
||
// Remove @Disabled annotation before usage | ||
@Disabled | ||
@Test | ||
@Tag(WarningNames.DUMMY_TEST_WARNING) | ||
fun `check dummy property`() { | ||
lintMethod( | ||
""" | ||
|// provide your check here | ||
""".trimMargin(), | ||
LintError(1, 1, ruleId, "${DUMMY_TEST_WARNING.warnText()} some detailed explanation", true) | ||
) | ||
} | ||
} |
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
9a2a218
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: