mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +00:00
Fixed texttests for Kotlin
This commit is contained in:
parent
c50c330c78
commit
8588b6fcc4
23
Kotlin/README.md
Normal file
23
Kotlin/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Gilded Rose starting position in Kotlin
|
||||
|
||||
## Run the Text Fixture from Command-Line
|
||||
|
||||
```
|
||||
./gradlew -q text
|
||||
```
|
||||
|
||||
### Specify Number of Days
|
||||
|
||||
For e.g. 10 days:
|
||||
|
||||
```
|
||||
./gradlew run --args 10
|
||||
```
|
||||
|
||||
You should make sure the gradle commands shown above work when you execute them in a terminal before trying to use TextTest (see below).
|
||||
|
||||
|
||||
## Run the TextTest approval test that comes with this project
|
||||
|
||||
There are instructions in the [TextTest Readme](../texttests/README.md) for setting up TextTest. What's unusual for the Java version is there are two executables listed in [config.gr](../texttests/config.gr) for Java. One uses Gradle wrapped in a python script, the other relies on your CLASSPATH being set correctly in [environment.gr](../texttests/environment.gr).
|
||||
|
||||
@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.9.10"
|
||||
application
|
||||
}
|
||||
|
||||
group = "com.gildedrose"
|
||||
@ -32,3 +33,7 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
java {
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("com.gildedrose.TexttestFixtureKt")
|
||||
}
|
||||
|
||||
@ -4,7 +4,8 @@ fun main(args: Array<String>) {
|
||||
|
||||
println("OMGHAI!")
|
||||
|
||||
val items = listOf(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), //
|
||||
@ -13,7 +14,8 @@ fun main(args: Array<String>) {
|
||||
Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||
Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||
// this conjured item does not work properly yet
|
||||
Item("Conjured Mana Cake", 3, 6))
|
||||
Item("Conjured Mana Cake", 3, 6)
|
||||
)
|
||||
|
||||
val app = GildedRose(items)
|
||||
|
||||
14
Kotlin/texttest_rig.py
Normal file
14
Kotlin/texttest_rig.py
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
This script uses Gradle to execute the TexttestFixture.
|
||||
It is designed to be used by TextTest and specified in the file 'texttests/config.gr' in this repo.
|
||||
It is more convenient for TextTest to use since Gradle needs
|
||||
several arguments in addition to the one the TextTest fixture needs.
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
args = " ".join(sys.argv[1:])
|
||||
TEXTTEST_HOME = os.environ.get("TEXTTEST_HOME", os.getcwd())
|
||||
subprocess.run(f"{TEXTTEST_HOME}/Kotlin/gradlew -p {TEXTTEST_HOME}/Kotlin -q run --args {args}", shell=True)
|
||||
@ -20,6 +20,10 @@ diff_program:meld
|
||||
#interpreter:java
|
||||
# note you'll also need to update the file environment.gr with your classpath if you keep your classfiles somewhere unusual
|
||||
|
||||
# Settings for the Kotlin version using Gradle wrapped in a python script
|
||||
#executable:${TEXTTEST_HOME}/Kotlin/texttest_rig.py
|
||||
#interpreter:python
|
||||
|
||||
# Settings for the Ruby version
|
||||
#executable:${TEXTTEST_HOME}/ruby/texttest_fixture.rb
|
||||
#interpreter:ruby
|
||||
|
||||
Loading…
Reference in New Issue
Block a user