Skip to content
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

Class with constants #451

Closed
clickjamper opened this issue Aug 15, 2023 · 8 comments
Closed

Class with constants #451

clickjamper opened this issue Aug 15, 2023 · 8 comments
Assignees
Labels
Bug Bug issue type Kover Coverage Tool S: confirmed Status: bug is reproduced or present

Comments

@clickjamper
Copy link

Why do you need to write tests for classes which contains only constants like

internal object TestObject { const val TEST_CONST = "test_const" }

@clickjamper clickjamper added Question Support request issue type S: untriaged Status: issue reported but unprocessed labels Aug 15, 2023
@shanshin
Copy link
Collaborator

Hi,
Kover notifies only that an object has been declared in the code that is not explicitly used anywhere.

Unfortunately, when compiling, the constant is not stored in the class, so Kover cannot determine exactly how this object will be used - independently or as a scope for grouping constants.

In this case, it is possible to exclude such classes from the report by name or using an annotation.

@shanshin shanshin added the S: in progress Status: implementing or design in process label Sep 11, 2023
@shanshin shanshin removed the S: untriaged Status: issue reported but unprocessed label Sep 21, 2023
@shanshin shanshin added Bug Bug issue type Kover Coverage Tool and removed Question Support request issue type labels Sep 21, 2023
@zuevmaxim
Copy link

@shanshin Fixed in agent version 1.0.741

@shanshin
Copy link
Collaborator

Fixed in Kover 0.7.5

@BulatInDrive
Copy link

I updated Kover to 0.7.5, but it still shows that an object containing only constants has no tests.
image

@shanshin shanshin reopened this Dec 5, 2023
@shanshin
Copy link
Collaborator

shanshin commented Dec 5, 2023

@BulatInDrive, thanks for the report!
The problem is reproduced for string constants

@hanrw
Copy link

hanrw commented Mar 16, 2024

Same issue shows that an interface containing companion object

Snipaste_2024-03-16_16-45-09

@shanshin shanshin added S: confirmed Status: bug is reproduced or present and removed S: in progress Status: implementing or design in process labels Mar 26, 2024
@shanshin
Copy link
Collaborator

Reproduced for companion objects

@shanshin
Copy link
Collaborator

Closed in favour of #583

@shanshin shanshin closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type Kover Coverage Tool S: confirmed Status: bug is reproduced or present
Projects
None yet
Development

No branches or pull requests

5 participants