mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +00:00
Merge pull request #417 from dmcg/master
Update versions in Kotlin variant, and use List rather than Array
This commit is contained in:
commit
227729512d
@ -1,7 +1,7 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.6.10"
|
kotlin("jvm") version "1.8.10"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.gildedrose"
|
group = "com.gildedrose"
|
||||||
@ -13,7 +13,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
|
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.gildedrose
|
package com.gildedrose
|
||||||
|
|
||||||
class GildedRose(var items: Array<Item>) {
|
class GildedRose(var items: List<Item>) {
|
||||||
|
|
||||||
fun updateQuality() {
|
fun updateQuality() {
|
||||||
for (i in items.indices) {
|
for (i in items.indices) {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ internal class GildedRoseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val items = arrayOf<Item>(Item("foo", 0, 0))
|
val items = listOf(Item("foo", 0, 0))
|
||||||
val app = GildedRose(items)
|
val app = GildedRose(items)
|
||||||
app.updateQuality()
|
app.updateQuality()
|
||||||
assertEquals("fixme", app.items[0].name)
|
assertEquals("fixme", app.items[0].name)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
println("OMGHAI!")
|
println("OMGHAI!")
|
||||||
|
|
||||||
val items = arrayOf(Item("+5 Dexterity Vest", 10, 20), //
|
val items = listOf(Item("+5 Dexterity Vest", 10, 20), //
|
||||||
Item("Aged Brie", 2, 0), //
|
Item("Aged Brie", 2, 0), //
|
||||||
Item("Elixir of the Mongoose", 5, 7), //
|
Item("Elixir of the Mongoose", 5, 7), //
|
||||||
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
||||||
@ -31,6 +31,4 @@ fun main(args: Array<String>) {
|
|||||||
println()
|
println()
|
||||||
app.updateQuality()
|
app.updateQuality()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user