cleaned up texttest_rig.py

This commit is contained in:
Ralf Comtesse 2025-09-18 22:00:26 +02:00
parent 7aae423d53
commit 3083e909b6
4 changed files with 75 additions and 7 deletions

View File

@ -1,8 +1,8 @@
package com.gildedrose package com.gildedrose
object TexttestFixture { object TexttestFixture {
@main
def main(args: String*): Unit = { def main(args: Array[String]): Unit = {
println("OMGHAI!") println("OMGHAI!")
val items = Array[Item]( val items = Array[Item](

14
scala/texttest_rig.py Normal file
View 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"""(cd {TEXTTEST_HOME}/scala/; sbt run "Test / runMain com.gildedrose.TexttestFixture {args}") """, shell=True)

View File

@ -1,3 +1,40 @@
[info] welcome to sbt 1.11.6 (Azul Systems, Inc. Java 21.0.8)
[info] loading global plugins from /Users/rco/.sbt/1.0/plugins
[info] loading settings for project scala-build-build from metals.sbt...
[info] loading project definition from /Users/rco/Developer/katas/GildedRose-Refactoring-Kata/scala/project/project
[info] loading project definition from /Users/rco/Developer/katas/GildedRose-Refactoring-Kata/scala/project
[success] Generated .bloop/scala-build.json
[success] Total time: 1 s, completed 26.09.2025, 20:01:30
[info] loading settings for project root from build.sbt...
[info] set current project to GildedRose (in build file:/Users/rco/Developer/katas/GildedRose-Refactoring-Kata/scala/)
[info] running com.gildedrose.Main
OMGHAI!
-------- day 0 --------
name, sellIn, quality
+5 Dexterity Vest, 10, 20
Aged Brie, 2, 0
Elixir of the Mongoose, 5, 7
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 15, 20
Backstage passes to a TAFKAL80ETC concert, 10, 49
Backstage passes to a TAFKAL80ETC concert, 5, 49
Conjured Mana Cake, 3, 6
-------- day 1 --------
name, sellIn, quality
+5 Dexterity Vest, 9, 19
Aged Brie, 1, 1
Elixir of the Mongoose, 4, 6
Sulfuras, Hand of Ragnaros, 0, 80
Sulfuras, Hand of Ragnaros, -1, 80
Backstage passes to a TAFKAL80ETC concert, 14, 21
Backstage passes to a TAFKAL80ETC concert, 9, 50
Backstage passes to a TAFKAL80ETC concert, 4, 50
Conjured Mana Cake, 2, 5
[success] Total time: 0 s, completed 26.09.2025, 20:01:31
[info] running com.gildedrose.TexttestFixture 30
OMGHAI! OMGHAI!
-------- day 0 -------- -------- day 0 --------
name, sellIn, quality name, sellIn, quality
@ -371,3 +408,4 @@ Backstage passes to a TAFKAL80ETC concert, -20, 0
Backstage passes to a TAFKAL80ETC concert, -25, 0 Backstage passes to a TAFKAL80ETC concert, -25, 0
Conjured Mana Cake, -27, 0 Conjured Mana Cake, -27, 0
[success] Total time: 0 s, completed 26.09.2025, 20:01:31

View File

@ -2,7 +2,7 @@ full_name:Gilded Rose Refactoring Kata
# set your preferred editor and diff tool. # set your preferred editor and diff tool.
view_program:subl view_program:subl
diff_program:meld diff_program:kdiff3
# Settings for the Python version # Settings for the Python version
#executable:${TEXTTEST_HOME}/python/texttest_fixture.py #executable:${TEXTTEST_HOME}/python/texttest_fixture.py
@ -25,8 +25,8 @@ diff_program:meld
#interpreter:python #interpreter:python
# Settings for the Java version using the classpath # Settings for the Java version using the classpath
#executable:com.gildedrose.TexttestFixture # executable:com.gildedrose.TexttestFixture
#interpreter:java # interpreter:java
# note you'll also need to update the file environment.gr with your classpath if you keep your classfiles somewhere unusual # 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 # Settings for the Kotlin version using Gradle wrapped in a python script
@ -34,8 +34,8 @@ diff_program:meld
#interpreter:python #interpreter:python
# Settings for the Ruby version # Settings for the Ruby version
executable:${TEXTTEST_HOME}/ruby/texttest_fixture.rb #executable:${TEXTTEST_HOME}/ruby/texttest_fixture.rb
interpreter:ruby #interpreter:ruby
# Settings for the C# Core version # Settings for the C# Core version
#executable:${TEXTTEST_HOME}/csharpcore/GildedRoseTests/bin/Debug/net8.0/GildedRoseTests #executable:${TEXTTEST_HOME}/csharpcore/GildedRoseTests/bin/Debug/net8.0/GildedRoseTests
@ -70,4 +70,20 @@ interpreter:ruby
# Settings for the Odin version # Settings for the Odin version
#executable:${TEXTTEST_HOME}/odin/gilded_rose<include your OS executable extension here> #executable:${TEXTTEST_HOME}/odin/gilded_rose<include your OS executable extension here>
# Settings for the scala version using the classpath
# executable:com.gildedrose.TexttestFixture
#executable:com.gildedrose.TexttestFixture.scala
#interpreter:"scala run"
# note you'll also need to update the file environment.gr with your classpath if you keep your classfiles somewhere unusual
# Settings for the scala version using sbt wrapped in a python script
executable:${TEXTTEST_HOME}/scala/texttest_rig.py
interpreter:python
filename_convention_scheme:standard filename_convention_scheme:standard
[run_dependent_text]
stdout:\[info\]
stdout:\[success\]
stdout:And lines like this