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

Exclude private protected members from BeEquivalentTo #2417

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

jnyrup
Copy link
Member

@jnyrup jnyrup commented Oct 29, 2023

This fixes #2409

I guess this is what I meant with this comment

IMPORTANT

  • If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.
  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used in these tests.
  • If the PR adds a feature or fixes a bug, please update the release notes with a functional description that explains what the change means to consumers of this library, which are published on the website.
  • If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.
  • If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
    • Please also run ./build.sh --target spellcheck or .\build.ps1 --target spellcheck before pushing and check the good outcome

@jnyrup jnyrup added the bug label Oct 29, 2023
@github-actions
Copy link

github-actions bot commented Oct 29, 2023

Qodana for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2023.2.8
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6684304303

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 97.351%

Files with Coverage Reduction New Missed Lines %
Src/FluentAssertions/Common/CSharpAccessModifierExtensions.cs 3 73.33%
Totals Coverage Status
Change from base Build 6663997299: -0.04%
Covered Lines: 11711
Relevant Lines: 11905

💛 - Coveralls

@IT-VBFK
Copy link
Contributor

IT-VBFK commented Oct 29, 2023

Weird code coverage, isn't it?

@jnyrup
Copy link
Member Author

jnyrup commented Oct 29, 2023

Yeah, saw the decrease but decided to close the computer for today and switch to watching conference talks on YouTube.

Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

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

Awesome!

@dennisdoomen
Copy link
Member

Yeah, saw the decrease but decided to close the computer for today and switch to watching conference talks on YouTube.

I know that feeling.

For properties and methods `PropertyInfoAssertions` and `MethodBaseAssertions` have assertions to exercise the `private`, `protected` and `private protected` cases in `GetCSharpAccessModifier(MethodBase)`.
We don't have `FieldInfoAssertions` so we only exercise the access modifiers on fields through `WhichGetterHas`/`WhichSetterHas`.
Since `GetFieldsFromHierarchy` excludes `private`, `protected` and `private protected` fields those three cases cannot currently be hit through the public API.
@jnyrup
Copy link
Member Author

jnyrup commented Oct 30, 2023

What I discovered when digging into the reduced code coverage.

For properties and methods PropertyInfoAssertions and MethodBaseAssertions have assertions to exercise the private, protected and private protected cases in GetCSharpAccessModifier(MethodBase).
We don't have FieldInfoAssertions so we only exercise the access modifiers on fields through WhichGetterHas/WhichSetterHas.
Since GetFieldsFromHierarchy excludes private, protected and private protected fields those three cases cannot currently be hit through the public API.

@jnyrup jnyrup merged commit 75aa13e into fluentassertions:develop Oct 30, 2023
5 checks passed
@jnyrup jnyrup deleted the issue2409 branch October 30, 2023 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

private protected members compared by default using BeEquivalentTo
4 participants