Skip to content

Commit

Permalink
Don't validate content of "Interleave" arg
Browse files Browse the repository at this point in the history
This is a squashed merge of PR morelinq#1031 that fixes morelinq#1029.
  • Loading branch information
atifaziz authored and julienasp committed Nov 14, 2023
1 parent 6aae305 commit 96f53b4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
14 changes: 0 additions & 14 deletions MoreLinq.Test/InterleaveTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ public void TestInterleaveDisposesOnErrorAtGetEnumerator()
Throws.BreakException);
}

/// <summary>
/// Verify that Interleave early throw ArgumentNullException when an element
/// of otherSequences is null.
/// </summary>
[Test]
public void TestInterleaveEarlyThrowOnNullElementInOtherSequences()
{
var sequenceA = Enumerable.Range(1, 1);
var otherSequences = new IEnumerable<int>[] { null! };

Assert.That(() => sequenceA.Interleave(otherSequences),
Throws.ArgumentNullException("otherSequences"));
}

/// <summary>
/// Verify that interleaving disposes those enumerators that it managed
/// to open successfully
Expand Down
2 changes: 0 additions & 2 deletions MoreLinq/Interleave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public static IEnumerable<T> Interleave<T>(this IEnumerable<T> sequence, params
{
if (sequence == null) throw new ArgumentNullException(nameof(sequence));
if (otherSequences == null) throw new ArgumentNullException(nameof(otherSequences));
if (otherSequences.Any(s => s == null))
throw new ArgumentNullException(nameof(otherSequences), "One or more sequences passed to Interleave was null.");

return Impl(otherSequences.Prepend(sequence));

Expand Down

0 comments on commit 96f53b4

Please sign in to comment.