-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support generic Kotlin inline value classes in parameterized tests #5145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Support generic Kotlin inline value classes in parameterized tests #5145
Conversation
|
Hi @marcphilipp 👋 Sorry for the delay — this is actually my first attempt at contributing to an open-source project like JUnit, As discussed in #5081, I’ve based this Draft PR on the There are still a few points I’d like to clarify, since I might have misunderstood parts of the earlier discussion:
I’m happy to adjust the scope based on your guidance. |
|
@marcphilipp 👋 |
marcphilipp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an entry to the 6.1.0-M2 release notes.
jupiter-tests/src/test/kotlin/org/junit/jupiter/api/kotlin/ResultTest.kt
Outdated
Show resolved
Hide resolved
jupiter-tests/src/test/kotlin/org/junit/jupiter/api/kotlin/CustomInlineValueClassTest.kt
Outdated
Show resolved
Hide resolved
🚨 TestLens detected 2 failed tests 🚨Here is what you can do:
Test Summary
🏷️ Commit: f56ddcb Test Failures (first 5 of 6)KotlinCoroutinesTests > failsWithHelpfulErrorMessageWhenKotlinReflectIsMissing(Path, OutputFiles) (:platform-tooling-support-tests:test in macOS)KotlinCoroutinesTests > failsWithHelpfulErrorMessageWhenKotlinReflectIsMissing(Path, OutputFiles) (:platform-tooling-support-tests:test in macOS)KotlinCoroutinesTests > failsWithHelpfulErrorMessageWhenKotlinReflectIsMissing(Path, OutputFiles) (:platform-tooling-support-tests:test in macOS)KotlinCoroutinesTests > failsWithHelpfulErrorMessageWhenKotlinxCoroutinesIsMissing(Path, OutputFiles) (:platform-tooling-support-tests:test in macOS)KotlinCoroutinesTests > failsWithHelpfulErrorMessageWhenKotlinxCoroutinesIsMissing(Path, OutputFiles) (:platform-tooling-support-tests:test in macOS)Muted TestsSelect tests to mute:
Reuse successful test results
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app. |
a4f9603 to
8373625
Compare
Issue: junit-team#5081 Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
8373625 to
7933e30
Compare
@Ogu1208 Do you have time to address this or should we take over? |
cf2abac to
6b1faa5
Compare
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
6b1faa5 to
f37fd16
Compare
|
Thank you for the feedback. I've added the release note entry. Please let me know if any adjustments are needed. Apologies for the delay. |
04a13c9 to
239468f
Compare
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
239468f to
f251983
Compare
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
Signed-off-by: Ogu1208 <kdasunb6@gmail.com>
Resolves: #5081
Overview
This PR builds upon @marcphilipp's POC
marc/5081-kotlin-value-class-supportto add support for generic inline value classes in@ParameterizedTestmethods whenkotlin-reflectis on the classpath.Supported: Generic Inline Value Classes
kotlin.Result<T>Container<T>)Objectin JVM, bypassing strict type validationNot Yet Supported: Primitive-Wrapper Inline Value Classes
UInt,ULong,UShort,UByteUserId(Long),Email(String))int,long, etc.), causing JUnit's type validation to fail before reaching the invocation logicChanges
Implementation
MethodReflectionUtils.invoke()to detect and handle inline value class argumentsKotlinReflectionUtils.isInstanceOfInlineType()to detect@JvmInlineannotated instancesKotlinReflectionUtils.invokeKotlinFunction()to invoke Kotlin functions with inline value class parametersKotlinSuspendingFunctionUtils→KotlinFunctionUtilsto support both suspending and regular functions@APIannotations to new public methodsTesting
GenericInlineValueClassTests: Verifies working cases (Result, nullable Result, custom generic containers)PrimitiveWrapperInlineValueClassTests(@disabled): Documents current limitations with primitive wrappersI hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@APIannotations