Skip to content

[TASK] Reduce and finetune the scope of @covers annotations #1188

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

Merged
merged 1 commit into from
Mar 18, 2025

Conversation

oliverklee
Copy link
Collaborator

The legacy tests are not very focused. Until we have split them up, try to avoid false positives for code coverage.

Also add @covers annotations for the parent classes of the tested classes.

@coveralls
Copy link

coveralls commented Mar 18, 2025

Coverage Status

coverage: 51.499% (-5.3%) from 56.839%
when pulling d6ad84c on task/coversnothing
into ff1af18 on main.

Copy link
Collaborator

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

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

Some of the TestCases do seem to at least partially cover some specific classes...

Comment on lines -13 to +12
* @covers \Sabberworm\CSS\OutputFormat
* @covers \Sabberworm\CSS\OutputFormatter
* @coversNothing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this cover Comment::render() and ParserState::consumeWhitespace()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment::render() is called. As far as I understand the tests (which is not far), they're about other elements rendering comments (or not) depending on the OutputFormat settings.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it's outputFormatter::comments() where the controlling logic is.

@@ -11,7 +11,7 @@
use Sabberworm\CSS\Parsing\OutputException;

/**
* @covers \Sabberworm\CSS\OutputFormat
* @coversNothing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this covering various OutputFormat methods (create* and some of the setters)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As far as I understand this test, it's not about covering how OutputFormat works, but about how other elements get rendered depending on the output format.

* @covers \Sabberworm\CSS\Value\LineName
* @covers \Sabberworm\CSS\Value\Size
* @covers \Sabberworm\CSS\Value\URL
* @coversNothing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree it's generally not clear which of the classes this covers - but doesn't it at least cover Settings to some extent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It calls code in Settings (and uses it). It does not test whether Settings actually work correctly, though, and the point of the tests is not testing Settings (as far as I understand them), but how other code works depending on the settings.

@oliverklee
Copy link
Collaborator Author

I'd like to reduce what the legacy tests cover in general, and re-add the @covers annotation when we move/rework the tests, and when we're really sure the behavior of which classes is actually tested (instead of only executed).

The legacy tests are not very focused. Until we have split them
up, try to avoid false positives for code coverage.

Also add `@covers` annotations for the parent classes of the
tested classes.
@oliverklee oliverklee requested a review from JakeQZ March 18, 2025 10:35
@JakeQZ JakeQZ merged commit e89a90c into main Mar 18, 2025
21 checks passed
@JakeQZ JakeQZ deleted the task/coversnothing branch March 18, 2025 10:41
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.

3 participants