Add assertCompilationError assertion to testlib#71
Merged
Conversation
Transfer the `assertCompilationError` test assertion from `core-jvm-compiler` (SpineEventEngine/core-jvm-compiler#101, `:base` test fixtures) into the Compiler's `testlib` module under `io.spine.testing.compiler`, so every Compiler consumer can reuse it instead of redeclaring a local copy. `AbstractCompilationErrorTest.assertCompilationFails` now delegates to the new function, dropping the duplicated `assertThrows<Compilation.Error>` + `tapConsole` pattern. Add `AssertionsSpec` covering the returned error, the captured console output, and the failure when no compilation error is raised. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017b7KWnPKYaMALDTEKtAjjc
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017b7KWnPKYaMALDTEKtAjjc
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a reusable assertCompilationError assertion to the testlib module (io.spine.testing.compiler) so compiler consumers can assert compilation failures while capturing (and suppressing) console diagnostics.
Changes:
- Introduces
assertCompilationError(action)returning(Compilation.Error, consoleOutput)captured viatapConsole. - Refactors
AbstractCompilationErrorTest.assertCompilationFailsto delegate to the new assertion (removing duplicatedassertThrows + tapConsolelogic). - Adds
AssertionsSpeccovering returned error, captured output, and the failure mode when no compilation error is thrown.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bumps the compiler version snapshot. |
| testlib/src/test/kotlin/io/spine/testing/compiler/AssertionsSpec.kt | Adds tests validating assertCompilationError behavior. |
| testlib/src/main/kotlin/io/spine/testing/compiler/Assertions.kt | Adds the new assertCompilationError helper. |
| testlib/src/main/kotlin/io/spine/testing/compiler/AbstractCompilationErrorTest.kt | Reuses the new helper for compilation-failure assertions. |
| .agents/tasks/transfer-assert-compilation-error.md | Agent task metadata/log for the work item. |
JVM method names cannot contain `.`, even when written with backticks. Rename the test from `return the thrown 'Compilation.Error'` to `return the thrown compilation error` so `:testlib:compileTestKotlin` succeeds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017b7KWnPKYaMALDTEKtAjjc
Refresh the embedded project version in the generated dependency reports to match the version bump. No production dependencies changed, so the only delta is the version string. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017b7KWnPKYaMALDTEKtAjjc
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #71 +/- ##
============================================
+ Coverage 75.55% 75.60% +0.05%
Complexity 677 677
============================================
Files 202 203 +1
Lines 3943 3947 +4
Branches 390 390
============================================
+ Hits 2979 2984 +5
+ Misses 846 845 -1
Partials 118 118 🚀 New features to boost your workflow:
|
armiol
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the
assertCompilationErrortest assertion to the Spine Compilertestlibmodule, in package
io.spine.testing.compiler.The function asserts that a given action fails compilation, returning the thrown
Compilation.Errortogether with the console output it produced. The output iscaptured via
tapConsole— so a deliberately provoked compilation error does notpollute the build log — and returned as the second component of the pair, letting
callers inspect the diagnostics.
It originates from
core-jvm-compiler(SpineEventEngine/core-jvm-compiler#101,
:basetest fixtures). Hosting it intestliblets every Compiler consumer reuse it instead of redeclaring a localcopy.
Changes
testlib: newAssertions.ktwithpublic fun assertCompilationError(...).AbstractCompilationErrorTest.assertCompilationFailsnow delegates to thenew function, removing the duplicated
assertThrows+tapConsolepattern (behavior-preserving — the abstract base is published API,with no in-repo subclasses).
AssertionsSpec: covers returning the error, capturing the console output,and failing when no compilation error is raised.
2.0.0-SNAPSHOT.053→2.0.0-SNAPSHOT.054.Also in this branch
A routine
configsubmodule sync (798c1ef) and the regenerated dependencyreports matching it (
c5edd7a):.gitmodules(the.agents/sharedupdatestrategy), shared
buildSrcGradle helpers,gradle.properties, and thepom.xml/dependencies.mdreports (transitive bumps such asspine-base411→413,
spine-server375→376,core-jvm-plugins073→077,prototap0.15→0.16). These are
config-distributed / generated files kept in sync and areindependent of the
testlibchange.Follow-up
Once the Compiler is released with this function,
core-jvm-compilershouldmigrate to it and drop its local copy. Tracked in
SpineEventEngine/core-jvm-compiler#102.
🤖 Generated with Claude Code
Generated by Claude Code