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

Introduce SkipLastWhile extension #1085

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

ArmoryNode
Copy link

@ArmoryNode ArmoryNode commented Oct 22, 2024

Adds SkipLastWhile extension method and associated tests

Closes #1036

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.27%. Comparing base (03a160c) to head (453b0ed).

Files with missing lines Patch % Lines
MoreLinq/SkipLastWhile.cs 97.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1085      +/-   ##
==========================================
+ Coverage   93.22%   93.27%   +0.04%     
==========================================
  Files         112      113       +1     
  Lines        3410     3449      +39     
  Branches      962      971       +9     
==========================================
+ Hits         3179     3217      +38     
- Misses        215      216       +1     
  Partials       16       16              
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Member

@atifaziz atifaziz left a comment

Choose a reason for hiding this comment

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

This is a really good quality PR. Thanks for picking up #1085 and taking the trouble to conform to the project's conventions.

I've left a few comments & suggestion from my initial review.

MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq/SkipLastWhile.cs Outdated Show resolved Hide resolved
MoreLinq/SkipLastWhile.cs Outdated Show resolved Hide resolved
MoreLinq/SkipLastWhile.cs Outdated Show resolved Hide resolved
ArmoryNode and others added 4 commits October 28, 2024 10:19
@ArmoryNode ArmoryNode requested a review from atifaziz October 30, 2024 17:59
Copy link
Member

@atifaziz atifaziz left a comment

Choose a reason for hiding this comment

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

Thanks for sharing your findings.

I have done a second review pass and submitted some suggestions and comments.

I reckon we need one final pass and then we can get this in! 🏁


PS Run build.cmd or build.sh locally to update the generated extensions since the CI checks/runs are failing due to stale code.

MoreLinq/SkipLastWhile.cs Show resolved Hide resolved
MoreLinq/SkipLastWhile.cs Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Outdated Show resolved Hide resolved
MoreLinq.Test/SkipLastWhileTest.cs Show resolved Hide resolved
using NUnit.Framework;

[TestFixture]
public class SkipLastWhileTest
Copy link
Member

Choose a reason for hiding this comment

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

Given that SkipLastWhile can be optimised for sequences, read-only lists and lists, you will want to test that the behaviour is identical irrespective of the source type. Have a look at some of the other tests to see how this is done, where we use TestExtensions.ToSourceKind to help with this.

Copy link
Author

@ArmoryNode ArmoryNode Nov 4, 2024

Choose a reason for hiding this comment

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

Due to BreakingCollection and BreakingReadOnlyCollection not being list-like, the test cases using them fail since IterateSequence uses a foreach loop, which will get the enumerator. Should I be testing for these cases? Considering that the IterateSequence method does get covered when using the SourceKind.Sequence test case. Also, do we want to test for different collection types on all of the applicable tests?

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.

Remove tail items while condition is true
3 participants