Browse Source

Enable ValueTypes.cs pretty test

pull/1425/head
Daniel Grunwald 7 years ago
parent
commit
af69c03442
  1. 1
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  2. 16
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs

1
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -260,7 +260,6 @@ namespace ICSharpCode.Decompiler.Tests
} }
[Test] [Test]
[Ignore("Special cases not implemented in new decompiler.")]
public void ValueTypes([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions) public void ValueTypes([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions); RunForLibrary(cscOptions: cscOptions);

16
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs

@ -51,8 +51,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
} }
} }
#if ROSLYN && OPT
// Roslyn optimizes out the explicit default-initialization
private static readonly S ReadOnlyS;
private static S MutableS;
#else
private static readonly S ReadOnlyS = default(S); private static readonly S ReadOnlyS = default(S);
private static S MutableS = default(S); private static S MutableS = default(S);
#endif
private static volatile int VolatileInt; private static volatile int VolatileInt;
public static void CallMethodViaField() public static void CallMethodViaField()
@ -63,12 +69,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
mutableS.SetField(); mutableS.SetField();
} }
#if !(ROSLYN && OPT) || COPY_PROPAGATION_FIXED
public static S InitObj1() public static S InitObj1()
{ {
S result = default(S); S result = default(S);
MakeArray(); MakeArray();
return result; return result;
} }
#endif
public static S InitObj2() public static S InitObj2()
{ {
@ -80,17 +88,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
p = default(S); p = default(S);
} }
public static S CallValueTypeCtor1() public static S CallValueTypeCtor()
{ {
return new S(10); return new S(10);
} }
public static S CallValueTypeCtor2()
{
S result = new S(10);
return result;
}
public static S Copy1(S p) public static S Copy1(S p)
{ {
return p; return p;

Loading…
Cancel
Save