Skip to content

Commit

Permalink
Add test case for interface inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
afxres committed May 3, 2024
1 parent b0292d7 commit dc5cbb5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,19 @@ public void GetAllFieldsAndPropertiesForNonInterfaceTypeWithInvalidTypeTest(Type
Assert.Equal(message, alpha.Message);
Assert.Equal(message, bravo.Message);
}

[Fact(DisplayName = "Compare Inheritance With Cancellation Token Test")]
public void CompareInheritanceCancellationTest()
{
var source = new CancellationTokenSource();
var compilation = CompilationModule.CreateCompilationFromThisAssembly();
var symbolString = compilation.GetSpecialType(SpecialType.System_String);
var symbolObject = compilation.GetSpecialType(SpecialType.System_Object);
var result = Symbols.CompareInheritance(compilation, symbolObject, symbolString, source.Token);
Assert.Equal(1, result);

source.Cancel();
var exception = Assert.Throws<OperationCanceledException>(() => Symbols.CompareInheritance(compilation, symbolObject, symbolString, source.Token));
Assert.Equal(source.Token, exception.CancellationToken);
}
}
2 changes: 1 addition & 1 deletion code/Binary/Internal/CommonModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void Insert(PropertyInfo member)
ThrowHelper.ThrowAmbiguousMembers(i.Key, type);
}

return result.ToImmutable();
return result.DrainToImmutable();
}

[RequiresUnreferencedCode(RequiresUnreferencedCodeMessage)]
Expand Down

0 comments on commit dc5cbb5

Please sign in to comment.