Merge pull request #417 from dmcg/master

Update versions in Kotlin variant, and use List rather than Array
This commit is contained in:
Emily Bache 2023-02-28 07:46:43 +01:00 committed by GitHub
commit 227729512d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.6.10"
kotlin("jvm") version "1.8.10"
}
group = "com.gildedrose"
@ -13,7 +13,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib"))
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
}
tasks.test {

View File

@ -1,6 +1,6 @@
package com.gildedrose
class GildedRose(var items: Array<Item>) {
class GildedRose(var items: List<Item>) {
fun updateQuality() {
for (i in items.indices) {

View File

@ -7,7 +7,7 @@ internal class GildedRoseTest {
@Test
fun foo() {
val items = arrayOf<Item>(Item("foo", 0, 0))
val items = listOf(Item("foo", 0, 0))
val app = GildedRose(items)
app.updateQuality()
assertEquals("fixme", app.items[0].name)

View File

@ -4,7 +4,7 @@ fun main(args: Array<String>) {
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("Elixir of the Mongoose", 5, 7), //
Item("Sulfuras, Hand of Ragnaros", 0, 80), //
@ -31,6 +31,4 @@ fun main(args: Array<String>) {
println()
app.updateQuality()
}
}