-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#235): spm should support custom tools version and platforms
improvement - use dsl make it's more readable
- Loading branch information
Showing
2 changed files
with
147 additions
and
10 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
87 changes: 87 additions & 0 deletions
87
kmmbridge/src/test/kotlin/co/touchlab/faktory/dependencyManager/SpmConfigTest.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,87 @@ | ||
package co.touchlab.faktory.dependencyManager | ||
|
||
import co.touchlab.faktory.dependencymanager.SpmConfig | ||
import org.junit.Test | ||
import kotlin.test.assertEquals | ||
|
||
class SpmConfigTest { | ||
|
||
@Test | ||
fun addMultiplePlatforms() { | ||
val config = SpmConfig().apply(fun SpmConfig.() { | ||
platforms { | ||
iOS { | ||
v("14") | ||
} | ||
macOS { | ||
v("13") | ||
} | ||
watchOS { | ||
v("7") | ||
} | ||
tvOS { | ||
v("14") | ||
} | ||
} | ||
}) | ||
|
||
assertEquals(""" | ||
.iOS(.v14), | ||
.macOS(.v13), | ||
.watchOS(.v7), | ||
.tvOS(.v14)""".trimMargin(), config.getPlatformsAsFormattedText()) | ||
} | ||
|
||
|
||
@Test | ||
fun addWatchOSToPlatforms() { | ||
val config = SpmConfig().apply(fun SpmConfig.() { | ||
platforms { | ||
watchOS { | ||
v("7") | ||
} | ||
} | ||
}) | ||
|
||
assertEquals(".watchOS(.v7)", config.getPlatformsAsFormattedText().trimIndent()) | ||
} | ||
|
||
@Test | ||
fun addTvOSToPlatforms() { | ||
val config = SpmConfig().apply(fun SpmConfig.() { | ||
platforms { | ||
tvOS { | ||
v("14") | ||
} | ||
} | ||
}) | ||
|
||
assertEquals(".tvOS(.v14)", config.getPlatformsAsFormattedText().trimIndent()) | ||
} | ||
|
||
@Test | ||
fun addMacOSToPlatforms() { | ||
val config = SpmConfig().apply(fun SpmConfig.() { | ||
platforms { | ||
macOS { | ||
v("13") | ||
} | ||
} | ||
}) | ||
|
||
assertEquals(".macOS(.v13)", config.getPlatformsAsFormattedText().trimIndent()) | ||
} | ||
|
||
@Test | ||
fun addIOSToPlatforms() { | ||
val config = SpmConfig().apply(fun SpmConfig.() { | ||
platforms { | ||
iOS { | ||
v("14") | ||
} | ||
} | ||
}) | ||
|
||
assertEquals(".iOS(.v14)", config.getPlatformsAsFormattedText().trimIndent()) | ||
} | ||
} |