From 8d56efb54f3cf990564ac53d42147f56b5639d9c Mon Sep 17 00:00:00 2001 From: Marcus Lagergren <1062473+lagergren@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:22:27 +0100 Subject: [PATCH 1/4] Updated xtc app template to correctly run tests and resolve automatically. NOTE: This cannot go in until we have the plugin bugfix that restores this functionality merged. --- hello-xtc/build.gradle.kts | 9 ++++++ hello-xtc/src/main/x/HelloWorld.x | 16 ++++++++-- hello-xtc/src/test/x/HelloWorldTest.x | 44 +++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 hello-xtc/src/test/x/HelloWorldTest.x diff --git a/hello-xtc/build.gradle.kts b/hello-xtc/build.gradle.kts index 9fc1534..abe9ac3 100644 --- a/hello-xtc/build.gradle.kts +++ b/hello-xtc/build.gradle.kts @@ -27,6 +27,15 @@ xtcRun { } } +// Note: The xtcTest task auto-discovers test modules from src/test/x. +// No explicit module configuration is needed - just place test modules in +// the test source set and they will be run as part of the build lifecycle. +// You can optionally configure test behavior here: +// xtcTest { +// failOnTestFailure = true // default +// // includes/excludes can be used to filter test modules +// } + // Print version information val printVersionInfo by tasks.registering { val xtcVersionTask = tasks.named("xtcVersion") diff --git a/hello-xtc/src/main/x/HelloWorld.x b/hello-xtc/src/main/x/HelloWorld.x index ead2daf..90a144f 100644 --- a/hello-xtc/src/main/x/HelloWorld.x +++ b/hello-xtc/src/main/x/HelloWorld.x @@ -1,7 +1,19 @@ module HelloWorld { + /** + * Format a greeting from the provided parts. + * + * @param prefix the greeting prefix (e.g., "Hello ") + * @param middle the middle part (e.g., "there, ") + * @param name the name to greet (e.g., "World") + * + * @return the formatted greeting string with an exclamation mark + */ + static String formatGreeting(String prefix, String middle, String name) { + return $"{prefix}{middle}{name}!"; + } + void run(String[] args = []) { @Inject Console console; - //assert:debug; - console.print($"{args[0]}{args[1]}{args[2]}!"); + console.print(formatGreeting(args[0], args[1], args[2])); } } diff --git a/hello-xtc/src/test/x/HelloWorldTest.x b/hello-xtc/src/test/x/HelloWorldTest.x new file mode 100644 index 0000000..74cc295 --- /dev/null +++ b/hello-xtc/src/test/x/HelloWorldTest.x @@ -0,0 +1,44 @@ +/** + * Unit tests for the HelloWorld module's greeting functionality. + * + * This test module demonstrates how to write xunit tests that are run + * as part of the Gradle build lifecycle via the `testXtc` task. + */ +module HelloWorldTest { + package greeting import HelloWorld; + + /** + * Tests for the formatGreeting() function. + */ + class GreeterTest { + @Test + void shouldFormatBasicGreeting() { + String result = greeting.formatGreeting("Hello ", "there, ", "World"); + assert result == "Hello there, World!"; + } + + @Test + void shouldFormatGreetingWithCustomName() { + String result = greeting.formatGreeting("Hello ", "there, ", "Marcus"); + assert result == "Hello there, Marcus!"; + } + + @Test + void shouldFormatGreetingWithEmptyParts() { + String result = greeting.formatGreeting("", "", "Test"); + assert result == "Test!"; + } + + @Test + void shouldFormatGreetingWithDifferentPrefix() { + String result = greeting.formatGreeting("Hi ", "dear ", "Friend"); + assert result == "Hi dear Friend!"; + } + + @Test + void shouldAlwaysAppendExclamationMark() { + String result = greeting.formatGreeting("A", "B", "C"); + assert result.endsWith("!"); + } + } +} From 4eaeea7ffadfc7810bf8fe0873e190e4fcf738ca Mon Sep 17 00:00:00 2001 From: Marcus Lagergren <1062473+lagergren@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:26:33 +0100 Subject: [PATCH 2/4] Remove deprecated gradle/wrapper-validation-action The wrapper validation is already included in gradle/actions/setup-gradle@v4, making the standalone action redundant. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/commit.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 82cca33..c2b69a9 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -21,9 +21,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v3 - - name: Set up JDK 25 uses: actions/setup-java@v4 with: From 0e8a4668e1c2b1d522bb304b88966dd37fd8c54f Mon Sep 17 00:00:00 2001 From: Marcus Lagergren <1062473+lagergren@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:28:48 +0100 Subject: [PATCH 3/4] Temporarily disable test source set to verify CI Testing if the build passes without the test module to isolate the plugin dependency issue. Co-Authored-By: Claude Opus 4.5 --- hello-xtc/src/{test => test.disabled}/x/HelloWorldTest.x | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hello-xtc/src/{test => test.disabled}/x/HelloWorldTest.x (100%) diff --git a/hello-xtc/src/test/x/HelloWorldTest.x b/hello-xtc/src/test.disabled/x/HelloWorldTest.x similarity index 100% rename from hello-xtc/src/test/x/HelloWorldTest.x rename to hello-xtc/src/test.disabled/x/HelloWorldTest.x From d3c036cf86756699d26878ed33f774a4bbb4b964 Mon Sep 17 00:00:00 2001 From: Marcus Lagergren <1062473+lagergren@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:30:35 +0100 Subject: [PATCH 4/4] Restore test source set Re-enabling tests - CI will fail until the plugin fix is merged. Co-Authored-By: Claude Opus 4.5 --- hello-xtc/src/{test.disabled => test}/x/HelloWorldTest.x | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hello-xtc/src/{test.disabled => test}/x/HelloWorldTest.x (100%) diff --git a/hello-xtc/src/test.disabled/x/HelloWorldTest.x b/hello-xtc/src/test/x/HelloWorldTest.x similarity index 100% rename from hello-xtc/src/test.disabled/x/HelloWorldTest.x rename to hello-xtc/src/test/x/HelloWorldTest.x