Browse Source

Add test cases

pull/2077/head
Siegfried Pammer 5 years ago
parent
commit
a231ab54d4
  1. 3
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  2. 2
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  3. 18
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs

3
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -257,6 +257,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -257,6 +257,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
preprocessorSymbols.Add("LEGACY_CSC");
preprocessorSymbols.Add("LEGACY_VBC");
}
if (flags.HasFlag(CompilerOptions.Preview)) {
preprocessorSymbols.Add("CS90");
}
return preprocessorSymbols;
}

2
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -199,7 +199,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -199,7 +199,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test]
public void LocalFunctions([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions | CompilerOptions.Preview);
}
[Test]

18
ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs

@ -23,6 +23,12 @@ namespace LocalFunctions @@ -23,6 +23,12 @@ namespace LocalFunctions
{
internal class LocalFunctions
{
[AttributeUsage(AttributeTargets.All)]
internal class MyAttribute : Attribute
{
}
public class Generic<T1> where T1 : struct, ICloneable, IConvertible
{
public int MixedLocalFunction<T2>() where T2 : ICloneable, IConvertible
@ -31,15 +37,21 @@ namespace LocalFunctions @@ -31,15 +37,21 @@ namespace LocalFunctions
object z = this;
for (int j = 0; j < 10; j++) {
int i = 0;
i += NonStaticMethod6<object>();
int NonStaticMethod6<T3>()
i += NonStaticMethod6<object>(0);
#if CS90
[My]
[return: My]
int NonStaticMethod6<T3>([My] int unused)
#else
int NonStaticMethod6<T3>(int unused)
#endif
{
t2 = default(T2);
int l = 0;
return NonStaticMethod6_1<T1>() + NonStaticMethod6_1<T2>() + z.GetHashCode();
int NonStaticMethod6_1<T4>()
{
return i + l + NonStaticMethod6<T4>() + StaticMethod1<decimal>();
return i + l + NonStaticMethod6<T4>(0) + StaticMethod1<decimal>();
}
}
}

Loading…
Cancel
Save