Skip to content

Commit

Permalink
fix problematic unit test on windows due to line ending conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Apr 18, 2019
1 parent 2a9d1a7 commit 1fb9ac4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
Also includes Pickle/Unpickle.
More info about Pyro: https://pyro4.readthedocs.io/</Description>
<Copyright>Copyright Irmen de Jong</Copyright>
<!--
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageLicenseFile>../LICENSE</PackageLicenseFile>
-->
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/irmen/Pyrolite</PackageProjectUrl>
<RepositoryUrl>https://github.com/irmen/Pyrolite.git</RepositoryUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ public void TestUnpickleRealProxy4() {
UnpickleRealProxy(pickledProxy);
}

[Fact] // fails on Windows due to "\r\n" line ending
[Fact]
public void TestUnpickleProto0Bytes() {
var pickle = File.ReadAllBytes("pickled_bytes_level0.dat");
// note: convert \r\n that may be inserted in the data file on windows, back to \n that pickle expects
var pickle = File.ReadAllText("pickled_bytes_level0.dat").Replace("\r\n", "\n");

PickleSerializer ser = new PickleSerializer();
string x = (string)ser.deserializeData(pickle);
string x = (string)ser.deserializeData(Encoding.UTF8.GetBytes(pickle));
Assert.Equal(2496, x.Length);

// validate that the bytes in the string are what we expect (based on md5 hash)
Expand Down

0 comments on commit 1fb9ac4

Please sign in to comment.