-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Save in diktat smoke tests #1060
Changes from 1 commit
7bbb809
1c17a11
ef40888
ed7a8be
85033ce
8795cc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[general] | ||
execCmd="./ktlint -R diktat-1.0.0-rc.2.jar" | ||
tags = ["smokeTest"] | ||
description = "SmokeTest" | ||
suiteName = "SmokeTest" | ||
|
||
[fix] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
execFlags="-F" | ||
resourceNameTestSuffix="Test" | ||
resourceNameExpectedSuffix="Expected" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ import kotlinx.browser.document | |
fun main() { | ||
(document.getElementById("myId") as HTMLElement).click() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ class D { | |
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
@file:Suppress( | ||
"PACKAGE_NAME_MISSING", | ||
"PACKAGE_NAME_INCORRECT_PATH", | ||
"PACKAGE_NAME_INCORRECT_PREFIX" | ||
) | ||
|
||
/** | ||
* Dolor sit amet | ||
*/ | ||
class Example | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,3 @@ fun foo(x : Int | |
) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,3 @@ class Example { | |
bar(x, y) | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,3 @@ private fun foo(node: ASTNode) { | |
|
||
setOf<Object>(IOException(), Properties(), LoggerFactory()) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,3 @@ fun mains() { | |
} | ||
httpClient.doRequest() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,3 @@ package org.cqfn.diktat | |
class Some { | ||
val config = Config() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,3 @@ fun foo() { | |
doSmth() | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,3 @@ fun foo1(bar: Bar): Baz { | |
fun foo2(bar: Bar): Baz { | ||
// placeholder | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ import org.gradle.kotlin.dsl.plugins | |
plugins { | ||
kotlin("jvm") | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,3 @@ run { | |
also { | ||
println("a") | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ run { | |
also { | ||
println("a") | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,10 +21,14 @@ class TestComparatorUnit(private val resourceFilePath: String, | |||||
/** | ||||||
* @param expectedResult | ||||||
* @param testFileStr | ||||||
* @param smoke | ||||||
* @return true if transformed file equals expected result, false otherwise | ||||||
*/ | ||||||
@Suppress("FUNCTION_BOOLEAN_PREFIX") | ||||||
fun compareFilesFromResources(expectedResult: String, testFileStr: String): Boolean { | ||||||
fun compareFilesFromResources( | ||||||
expectedResult: String, | ||||||
testFileStr: String, | ||||||
smoke: Boolean = false): Boolean { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
To make it look like a more general option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||||||
val expectedPath = javaClass.classLoader.getResource("$resourceFilePath/$expectedResult") | ||||||
val testPath = javaClass.classLoader.getResource("$resourceFilePath/$testFileStr") | ||||||
if (testPath == null || expectedPath == null) { | ||||||
|
@@ -43,6 +47,13 @@ class TestComparatorUnit(private val resourceFilePath: String, | |||||
copyTestFile.absolutePath | ||||||
) | ||||||
|
||||||
if (smoke) { | ||||||
val actual: MutableList<String> = mutableListOf() | ||||||
actual.addAll(actualResult.split("\n")) | ||||||
actual.removeLast() | ||||||
petertrr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
return FileComparator(expectedFile, actual).compareFilesEqual() | ||||||
} | ||||||
|
||||||
// fixme: actualResult is separated by KtLint#determineLneSeparator, should be split by it here too | ||||||
return FileComparator(expectedFile, actualResult.split("\n")).compareFilesEqual() | ||||||
} | ||||||
|
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 thought we were planning to execute SAVE in CI too?