Browse Source

Add more test cases

pull/1953/head
Siegfried Pammer 5 years ago
parent
commit
199d38b85a
  1. 26
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs

26
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs

@ -68,16 +68,42 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{ {
} }
} }
private class Container<T1, T2>
{
public GenericStruct<T1, T2> Other;
}
private struct GenericStruct<T1, T2> private struct GenericStruct<T1, T2>
{ {
public T1 Field1; public T1 Field1;
public T2 Field2; public T2 Field2;
public Container<T1, T2> Other;
public override string ToString() public override string ToString()
{ {
return "(" + Field1?.ToString() + ", " + Field2?.ToString() + ")"; return "(" + Field1?.ToString() + ", " + Field2?.ToString() + ")";
} }
public int? GetTextLength()
{
return Field1?.ToString().Length + Field2?.ToString().Length + 4;
}
public string Chain1()
{
return Other?.Other.Other?.Other.Field1?.ToString();
}
public string Chain2()
{
return Other?.Other.Other?.Other.Field1?.ToString()?.GetType().Name;
}
public int? GetTextLengthNRE()
{
return (Field1?.ToString()).Length;
}
} }
public interface ITest public interface ITest

Loading…
Cancel
Save