Add TextEquals helper methods to Utf8JsonReader (dotnet/corefx#35979)
authorAhson Khan <ahkha@microsoft.com>
Fri, 15 Mar 2019 05:38:46 +0000 (22:38 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Mar 2019 05:38:46 +0000 (22:38 -0700)
commitf690b7509a1ff3cd19aaa8f89583d88263780e5b
treed32c48db65aed0d9ae8b3f425a727c8c9dba9e50
parentb2721fcd102d8f54aac61eafce615994030d5e3a
Add TextEquals helper methods to Utf8JsonReader (dotnet/corefx#35979)

* Add initial impl of ValueEquals with basic tests.

* Rename to TextEquals based on API review feedback.

* Move to separate test file, increase coverage, and fill in missing impl
details.

* Add xml comments and more test cases.

* Re-enable all the tests.

* Update tests to be netstandard compliant.

* Rename some existing tests to be clearer.

* Address PR feedback.

* Return early if we know unescaping won't produce a match.

* More eagerly check the lengths to return mismatch sooner.

* Add tests to improve code coverage and re-write to avoid unreachable
code.

* Fix resource string merge issue.

* Fix test build failures on netstandard (missing implicit string->span
cast)

Commit migrated from https://github.com/dotnet/corefx/commit/b8bc4ff80c5f7baa681e8a569d367356957ba78a
src/libraries/System.Text.Json/ref/System.Text.Json.cs
src/libraries/System.Text.Json/src/Resources/Strings.resx
src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs
src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.Unescaping.cs
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.cs
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
src/libraries/System.Text.Json/tests/System.Text.Json.Tests.csproj
src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.MultiSegment.cs
src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TextEquals.cs [new file with mode: 0644]
src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.cs