-
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.
Merge branch 'hotfix/langsamu-hotfix'
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2018 Alessio Gogna | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using Xunit; | ||
|
||
namespace ExpressionTreeToolkit.UnitTests | ||
{ | ||
public class Bugs | ||
{ | ||
private readonly IEqualityComparer<Expression> _target = ExpressionEqualityComparer.Default; | ||
|
||
private void AssertAreEqual(Expression x, Expression y) | ||
{ | ||
Assert.True(_target.Equals(x, y)); | ||
Assert.Equal(_target.GetHashCode(x), _target.GetHashCode(y)); | ||
} | ||
|
||
private void AssertAreNotEqual(Expression x, Expression y) | ||
{ | ||
Assert.False(_target.Equals(x, y)); | ||
} | ||
|
||
[Fact] | ||
public void Issue_4() | ||
{ | ||
// Expression similar to this code `try { } catch (Exception) { }` | ||
// Same expression twice to evade reference equality check | ||
var x = Expression.TryCatch(Expression.Empty(), Expression.Catch(typeof(Exception), Expression.Empty())); | ||
var y = Expression.TryCatch(Expression.Empty(), Expression.Catch(typeof(Exception), Expression.Empty())); | ||
|
||
AssertAreEqual(x, y); | ||
} | ||
} | ||
} |