forked from jellyfin/jellyfin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for ReadOnlySpan.Count extension
- Loading branch information
Showing
3 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/Jellyfin.Controller.Tests/Extensions/StringExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using MediaBrowser.Controller.Extensions; | ||
using Xunit; | ||
|
||
namespace Jellyfin.Controller.Extensions.Tests | ||
{ | ||
public class StringExtensionsTests | ||
{ | ||
[Theory] | ||
[InlineData("", '_', 0)] | ||
[InlineData("___", '_', 3)] | ||
[InlineData("test\x00", '\x00', 1)] | ||
[InlineData("Imdb=tt0119567|Tmdb=330|TmdbCollection=328", '|', 2)] | ||
public void ReadOnlySpan_Count_Success(string str, char needle, int count) | ||
{ | ||
Assert.Equal(count, str.AsSpan().Count(needle)); | ||
} | ||
} | ||
} |