mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Lists instead of ArrayLists.
This commit is contained in:
parent
ecc2e04ddb
commit
b518824679
2 changed files with 10 additions and 13 deletions
|
@ -4,7 +4,6 @@ import com.beust.kobalt.misc.log
|
|||
import java.io.File
|
||||
import java.nio.file.*
|
||||
import java.nio.file.attribute.BasicFileAttributes
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Subclasses of IFileSpec can be turned into a list of files. There are two kings: FileSpec (a single file)
|
||||
|
@ -19,7 +18,7 @@ sealed class IFileSpec {
|
|||
override public fun toString() = spec
|
||||
}
|
||||
|
||||
class GlobSpec(val spec: ArrayList<String>) : IFileSpec() {
|
||||
class GlobSpec(val spec: List<String>) : IFileSpec() {
|
||||
|
||||
constructor(spec: String) : this(arrayListOf(spec))
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.testng.annotations.DataProvider
|
|||
import org.testng.annotations.Test
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.util.*
|
||||
|
||||
class IncludeExcludeTest : KobaltTest() {
|
||||
private lateinit var topDirectory: File
|
||||
|
@ -31,21 +30,20 @@ class IncludeExcludeTest : KobaltTest() {
|
|||
|
||||
@DataProvider
|
||||
fun dp() : Array<Array<out Any?>> = arrayOf(
|
||||
arrayOf(directory, arrayListOf("A**class", "B**class"), arrayListOf<String>(), listOf(A1, B1, B2)),
|
||||
arrayOf(directory, arrayListOf("A**class", "B**class"), arrayListOf("B*class"), listOf(A1)),
|
||||
arrayOf(directory, arrayListOf("*class"), arrayListOf("B*class"), listOf(A1, C1, C2, C3)),
|
||||
arrayOf(topDirectory, arrayListOf("**/*class"), arrayListOf<String>(), listOf(A1, B1, B2, C1, C2, C3)),
|
||||
arrayOf(topDirectory, arrayListOf("*class"), arrayListOf<String>(), listOf<String>()),
|
||||
arrayOf(topDirectory, arrayListOf("**/B*class"), arrayListOf<String>(), listOf(B1, B2)),
|
||||
arrayOf(topDirectory, arrayListOf("**/A*class", "**/B*class"), arrayListOf("B*class"),
|
||||
arrayOf(directory, listOf("A**class", "B**class"), listOf<String>(), listOf(A1, B1, B2)),
|
||||
arrayOf(directory, listOf("A**class", "B**class"), listOf("B*class"), listOf(A1)),
|
||||
arrayOf(directory, listOf("*class"), listOf("B*class"), listOf(A1, C1, C2, C3)),
|
||||
arrayOf(topDirectory, listOf("**/*class"), listOf<String>(), listOf(A1, B1, B2, C1, C2, C3)),
|
||||
arrayOf(topDirectory, listOf("*class"), listOf<String>(), listOf<String>()),
|
||||
arrayOf(topDirectory, listOf("**/B*class"), listOf<String>(), listOf(B1, B2)),
|
||||
arrayOf(topDirectory, listOf("**/A*class", "**/B*class"), listOf("B*class"),
|
||||
listOf(A1, B1, B2)),
|
||||
arrayOf(topDirectory, arrayListOf("**/A*class", "**/B*class"), arrayListOf("**/B*class"),
|
||||
arrayOf(topDirectory, listOf("**/A*class", "**/B*class"), listOf("**/B*class"),
|
||||
listOf(A1))
|
||||
)
|
||||
|
||||
@Test(dataProvider = "dp")
|
||||
fun shouldInclude(root: File, includedSpec: ArrayList<String>, excludedSpec: ArrayList<String>,
|
||||
expectedFiles: List<String>) {
|
||||
fun shouldInclude(root: File, includedSpec: List<String>, excludedSpec: List<String>, expectedFiles: List<String>) {
|
||||
val g = IFileSpec.GlobSpec(includedSpec)
|
||||
val files = g.toFiles(root.path, excludedSpec.map { Glob(it) })
|
||||
Assert.assertEquals(files.map { it.name }, expectedFiles)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue