Is there an implementation policy for failing test...
# kontributors
w
Is there an implementation policy for failing tests(tests that will fail if the problem is fixed)? I'm currently trying to fix KT-31141, and I'm working on improving the coverage of test patterns in it. On the other hand, some of the test patterns I have implemented fail due to problems that cannot be solved by my modifications. For such contents, I would like to make the modifications detectable, instead of simply commenting them out. In
jackson-module-kotlin
, which I have committed, failing test was implemented in such a situation. So I would like to ask if there is anything similar in the
Kotlin
repository.
d
Hi The best way to handle this is create separate YT issue with details of problems which you discovered. As for tests you can 1. Just attach those testcases to issue 2. Commit them in your PR in separate commit with mentionaing issue number (like
Add tests for KT-XXXXX
). Those tests should be muted in code. If it's a black box test you can add
// IGNORE_BACKEND: JVM
(or
JVM_IR
, if tests fails only on IR backend) to the top of your testfile
w
@dmitriy.novozhilov Thank you for your reply. Let me explain the situation in more detail. I am working on a fix for a problem that causes calls to
KFunction
to fail if the argument or
extension receiver
is a
value class
and they are not
unbox
in the
JVM
. There seem to be multiple causes of this problem, but not all of them have been identified exactly. (I have commented on the status of the investigation to YT, but have not received a reply.) Also, most of the tests related to these issues have not been implemented. So, I thought it would be better to solve the problems in the following order. 1. Add failing tests to improve test coverage. 2. Investigate and fix individual problems based on 1. Currently, the tests are so lacking that it seems difficult to investigate individual problems and check for fixes. Please let me consult with you again on what to do on this. (I rely on machine translation for English, so I apologize for any rude expressions.)
As a supplement, I'll share the branch I'm working on. https://github.com/JetBrains/kotlin/compare/1.6.20... .k163377:fix_KT-31141 This branch divides the
primary val
of the
value class
into three patterns, and adds a test for when each has a
non-null
or
nullable
argument. Also, one of the problems is fixed. However, the case of nested
value class
was not taken into account, so more tests are needed to cover it completely.
d
@udalov can you help with it?
🙏 1
🙏 1
u
Hi! I’m OK with adding these tests to the repo. However I’d prefer that each test would either be completely muted (with
// IGNORE_BACKEND: JVM
), or everything in it would work. Right now there are some tests with commented lines — this makes it easy to forget to uncomment them later.
w
@udalov This is the way I envisioned it to be done, is that correct?
Copy code
assertFailsWith<IllegalArgumentException>("Please remove assertFailsWith and try again, as this problem may have been fixed.") {
    assertEquals(S("ab"), c.nullableUnboundRef().call(c))
}
u
Yeah, looks great!
🙏 1
w
I was able to create a PR. Thanks again for your help. https://github.com/JetBrains/kotlin/pull/4743