Skip to content

Commit

Permalink
Trying to fix Windows related test
Browse files Browse the repository at this point in the history
  • Loading branch information
pachanga committed Dec 2, 2024
1 parent d0821af commit 411276b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ public void AssertError<T>(Action action, string msg, PlaceAssert place_assert =

public void AssertError(Exception err, string msg, PlaceAssert place_assert = null)
{
msg = msg.Replace("\r", "");

if(err == null)
Assert.Fail("No error happened, expected: " + msg);

Expand All @@ -883,16 +885,15 @@ public void AssertError(Exception err, string msg, PlaceAssert place_assert = nu
err = (Exception)mex.errors[0];
}

var err_str = err.ToString();
var err_str = err.ToString().Replace("\r", "");
var idx = err_str.IndexOf(msg);
if(idx == -1)
{
Console.Error.WriteLine("Actual:\n" + err_str);
Console.Error.WriteLine("Expected:\n" + msg);

Assert.Fail("Sub-string not found");
Console.WriteLine("Actual:\n" + err_str);
Console.WriteLine("Expected:\n" + msg);
}

Assert.Contains(msg, err_str);

if(place_assert != null)
{
Expand Down

0 comments on commit 411276b

Please sign in to comment.