Browse Source

Add basic interface tests.

pull/1440/head
Siegfried Pammer 6 years ago
parent
commit
9437c6e4ad
  1. 1
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  2. 6
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  3. 36
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.cs
  4. 81
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.il
  5. 81
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.il
  6. 85
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.roslyn.il
  7. 87
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.roslyn.il
  8. 17
      ICSharpCode.Decompiler.Tests/Types/S_TypeDeclarations.cs

1
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -91,6 +91,7 @@ @@ -91,6 +91,7 @@
<Compile Include="TestCases\Pretty\OptionalArguments.cs" />
<Compile Include="TestCases\Pretty\CustomShortCircuitOperators.cs" />
<Compile Include="TestCases\Pretty\ReduceNesting.cs" />
<Compile Include="TestCases\Pretty\InterfaceTests.cs" />
<Compile Include="TestCases\Pretty\YieldReturn.cs" />
<None Include="TestCases\ILPretty\Issue1256.il" />
<None Include="TestCases\ILPretty\Issue1323.il" />

6
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -402,6 +402,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -402,6 +402,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void InterfaceTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
[Ignore("missing 'new' modifiers in a lot of contexts.")]
public void TypeMemberTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)

36
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.cs

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class InterfaceTests
{
public interface IA
{
}
public interface IA2 : IA
{
}
public interface IB
{
}
public class C : IA2, IA, IB
{
}
}
}

81
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.il

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly InterfaceTests
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module InterfaceTests.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class interface abstract auto ansi nested public IA
{
} // end of class IA
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method C::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

81
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.il

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly InterfaceTests.opt
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module InterfaceTests.opt.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class interface abstract auto ansi nested public IA
{
} // end of class IA
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method C::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

85
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.roslyn.il

@ -0,0 +1,85 @@ @@ -0,0 +1,85 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly InterfaceTests
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module InterfaceTests.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class interface abstract auto ansi nested public IA
{
} // end of class IA
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method C::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

87
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.roslyn.il

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly InterfaceTests
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module InterfaceTests.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class interface abstract auto ansi nested public IA
{
} // end of class IA
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method C::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

17
ICSharpCode.Decompiler.Tests/Types/S_TypeDeclarations.cs

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
using System;
namespace ClassMultiInterface
{
public interface IA
{
}
public interface IA2 : IA
{
}
public interface IB
{
}
public class C : IA2, IB
{
}
}
Loading…
Cancel
Save