Skip to content

Add assertCompilationError assertion to testlib#71

Merged
alexander-yevsyukov merged 8 commits into
masterfrom
claude/dazzling-rubin-g2qy8e
Jun 18, 2026
Merged

Add assertCompilationError assertion to testlib#71
alexander-yevsyukov merged 8 commits into
masterfrom
claude/dazzling-rubin-g2qy8e

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What

Adds the assertCompilationError test assertion to the Spine Compiler testlib
module, in package io.spine.testing.compiler.

The function asserts that a given action fails compilation, returning the thrown
Compilation.Error together with the console output it produced. The output is
captured via tapConsole — so a deliberately provoked compilation error does not
pollute 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, :base test fixtures). Hosting it in
testlib lets every Compiler consumer reuse it instead of redeclaring a local
copy.

Changes

  • testlib: new Assertions.kt with public fun assertCompilationError(...).
  • AbstractCompilationErrorTest.assertCompilationFails now delegates to the
    new function, removing the duplicated assertThrows +
    tapConsole pattern (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.
  • Version bump 2.0.0-SNAPSHOT.0532.0.0-SNAPSHOT.054.

Also in this branch

A routine config submodule sync (798c1ef) and the regenerated dependency
reports matching it (c5edd7a): .gitmodules (the .agents/shared update
strategy), shared buildSrc Gradle helpers, gradle.properties, and the
pom.xml / dependencies.md reports (transitive bumps such as spine-base
411→413, spine-server 375→376, core-jvm-plugins 073→077, prototap
0.15→0.16). These are config-distributed / generated files kept in sync and are
independent of the testlib change.

Follow-up

Once the Compiler is released with this function, core-jvm-compiler should
migrate to it and drop its local copy. Tracked in
SpineEventEngine/core-jvm-compiler#102.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits June 18, 2026 01:01
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via tapConsole.
  • Refactors AbstractCompilationErrorTest.assertCompilationFails to delegate to the new assertion (removing duplicated assertThrows + tapConsole logic).
  • Adds AssertionsSpec covering 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.

Comment thread testlib/src/main/kotlin/io/spine/testing/compiler/Assertions.kt
claude added 2 commits June 18, 2026 01:12
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
@alexander-yevsyukov alexander-yevsyukov self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 01:39
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review June 18, 2026 01:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@alexander-yevsyukov alexander-yevsyukov moved this to 🏗 In progress in v2.0 Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 01:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 53 changed files in this pull request and generated 2 comments.

Comment thread docs/dependencies/pom.xml
Comment thread .gitmodules
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.60%. Comparing base (91d84d0) to head (efc2a49).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexander-yevsyukov alexander-yevsyukov merged commit 944a8ba into master Jun 18, 2026
9 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the claude/dazzling-rubin-g2qy8e branch June 18, 2026 08:08
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in v2.0 Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants