From 79f509eeaf37360a9c4e680ce93e18f993c08b0a Mon Sep 17 00:00:00 2001 From: Emily Bache Date: Fri, 3 Nov 2023 13:06:02 +0000 Subject: [PATCH] add convenience script to run texttests --- .gitignore | 3 ++- Java/README.md | 6 +++++- Java/gradle.properties | 1 + start_texttest.bat | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 Java/gradle.properties create mode 100644 start_texttest.bat diff --git a/.gitignore b/.gitignore index f86e7561..953deaa5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ obj vendor .idea *.iml -csharpcore/GildedRoseTests/ApprovalTest.ThirtyDays.received.txt +**/*.received.* +venv diff --git a/Java/README.md b/Java/README.md index 184c948b..3b7493a7 100644 --- a/Java/README.md +++ b/Java/README.md @@ -14,6 +14,10 @@ For e.g. 10 days: ./gradlew -q text --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](https://github.com/emilybache/GildedRose-Refactoring-Kata/blob/main/texttests/README.md) for setting up TextTest. What's unusual for the Java version is there are two executables listed in [config.gr](https://github.com/emilybache/GildedRose-Refactoring-Kata/blob/main/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](https://github.com/emilybache/GildedRose-Refactoring-Kata/blob/main/texttests/environment.gr). +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). + diff --git a/Java/gradle.properties b/Java/gradle.properties new file mode 100644 index 00000000..8e7aecc2 --- /dev/null +++ b/Java/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED diff --git a/start_texttest.bat b/start_texttest.bat new file mode 100644 index 00000000..d13f4432 --- /dev/null +++ b/start_texttest.bat @@ -0,0 +1,14 @@ +set TEXTTEST_HOME=%~dp0 +cd %TEXTTEST_HOME% + +if not exist "venv" ( + py -m venv venv +) + +venv\Scripts\pip install texttest + +if %ERRORLEVEL% GEQ 1 ( + pause +) else ( + venv\Scripts\texttestc.py -con %* +)