Skip to content

Add negative tests for all meta-use-site target#2911

Merged
jaschdoc merged 3 commits intomainfrom
add-negative-tests
May 4, 2026
Merged

Add negative tests for all meta-use-site target#2911
jaschdoc merged 3 commits intomainfrom
add-negative-tests

Conversation

@jaschdoc
Copy link
Copy Markdown
Collaborator

@jaschdoc jaschdoc commented May 1, 2026

Depends on #2915

This PR adds the following:

  • Adds a failing test for invalid use of the all use-site target on grouped annotations (see KEEP 402)

  • Adds a runFailingTest function to AbstractKSPTest that asserts the expected output does not match the actual output

  • Adds a runThrowingTest function to AbstractKSPTest that asserts the test throws an InternalKSPException. This can be expanded to assert other types of exceptions, but for now the idea is that it forces throwing expressions to use InternalKSPException which provides an error message with a bit more information than what one might provide with error or require.

  • Refactor runTest, runFailingTest, runThrowingTest to reuse test setup code.

@jaschdoc jaschdoc changed the title Add negative tests for all meta-use-site target Add negative tests for all meta-use-site target May 4, 2026
@jaschdoc jaschdoc force-pushed the add-negative-tests branch 2 times, most recently from 1847c6e to 04b5319 Compare May 4, 2026 09:45
@jaschdoc
Copy link
Copy Markdown
Collaborator Author

jaschdoc commented May 4, 2026

Btw, since this PR was opened, a code/execution path that previously threw an exception has been fixed with a proper implementation on main. That leaves the runThrowingTest unused, but I have seen the implementation of runThrowingTest succeed by inserting exceptions (both being green by using InternalKSPException and being red under no exception and just kotlin.Exception).

@jaschdoc jaschdoc marked this pull request as ready for review May 4, 2026 09:52
@jaschdoc jaschdoc requested a review from troelsbjerre as a code owner May 4, 2026 09:52
troelsbjerre
troelsbjerre previously approved these changes May 4, 2026
@jaschdoc jaschdoc dismissed troelsbjerre’s stale review May 4, 2026 11:02

The merge-base changed after approval.

@jaschdoc jaschdoc force-pushed the add-negative-tests branch from 04b5319 to 631dee3 Compare May 4, 2026 11:02
@jaschdoc jaschdoc requested a review from troelsbjerre May 4, 2026 11:03
@jaschdoc
Copy link
Copy Markdown
Collaborator Author

jaschdoc commented May 4, 2026

Rebased on main

@jaschdoc jaschdoc merged commit 5dbf127 into main May 4, 2026
4 checks passed
@jaschdoc jaschdoc deleted the add-negative-tests branch May 4, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants