-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from cashapp/jwilson.1009.gradle_plugin
Basic Gradle plugin test
- Loading branch information
Showing
9 changed files
with
113 additions
and
141 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
65 changes: 65 additions & 0 deletions
65
burst-gradle-plugin/src/test/kotlin/app/cash/burst/gradle/junitXml.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,65 @@ | ||
/* | ||
* Copyright (C) 2024 Cash App | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package app.cash.burst.gradle | ||
|
||
import java.io.File | ||
import javax.xml.parsers.DocumentBuilderFactory | ||
import org.w3c.dom.Element | ||
|
||
fun readTestSuite(xmlFile: File): TestSuite { | ||
val builder = DocumentBuilderFactory.newInstance().newDocumentBuilder() | ||
val document = builder.parse(xmlFile) | ||
return document.documentElement.toTestSuite() | ||
} | ||
|
||
internal fun Element.toTestSuite(): TestSuite { | ||
val testCases = mutableListOf<TestCase>() | ||
for (i in 0 until childNodes.length) { | ||
val item = childNodes.item(i) | ||
if (item !is Element || item.tagName != "testcase") continue | ||
testCases += item.toTestCase() | ||
} | ||
|
||
return TestSuite( | ||
name = getAttribute("name"), | ||
testCases = testCases, | ||
) | ||
} | ||
|
||
internal fun Element.toTestCase(): TestCase { | ||
var skipped = false | ||
for (i in 0 until childNodes.length) { | ||
val item = childNodes.item(i) | ||
if (item is Element && item.tagName == "skipped") { | ||
skipped = true | ||
} | ||
} | ||
|
||
return TestCase( | ||
name = getAttribute("name"), | ||
skipped = skipped, | ||
) | ||
} | ||
|
||
class TestSuite( | ||
val name: String, | ||
val testCases: List<TestCase>, | ||
) | ||
|
||
class TestCase( | ||
val name: String, | ||
val skipped: Boolean, | ||
) |
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: 0 additions & 22 deletions
22
.../src/test/projects/basic/lib/src/commonMain/kotlin/app/cash/zipline/tests/GreetService.kt
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
burst-gradle-plugin/src/test/projects/basic/lib/src/commonTest/kotlin/CoffeeTest.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,16 @@ | ||
import app.cash.burst.Burst | ||
import kotlin.test.Test | ||
|
||
@Burst | ||
class CoffeeTest { | ||
val log = mutableListOf<String>() | ||
|
||
@Test | ||
fun test(espresso: Espresso, dairy: Dairy) { | ||
log += "running $espresso $dairy" | ||
} | ||
} | ||
|
||
enum class Espresso { Decaf, Regular, Double } | ||
|
||
enum class Dairy { None, Milk, Oat } |
29 changes: 0 additions & 29 deletions
29
.../test/projects/basic/lib/src/jsMain/kotlin/app/cash/zipline/tests/launchGreetServiceJs.kt
This file was deleted.
Oops, something went wrong.
70 changes: 0 additions & 70 deletions
70
...est/projects/basic/lib/src/jvmMain/kotlin/app/cash/zipline/tests/launchGreetServiceJvm.kt
This file was deleted.
Oops, something went wrong.
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