Skip to content

Commit 26daecc

Browse files
committed
update unit tests for upgraded disassembler output
1 parent e572011 commit 26daecc

File tree

5 files changed

+13
-141
lines changed

5 files changed

+13
-141
lines changed

CSharpRepl.Tests/Data/Disassembly/TopLevelProgram.Output.Debug.il

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Method begins at RVA 0x206c
1+
// Method begins at RVA 0x2050
22
// Header size: 12
33
// Code size: 14 (0xe)
44
.maxstack 2
@@ -19,4 +19,4 @@ IL_0007: call void [System.Console]System.Console::WriteLine(int32)
1919
IL_000c: nop
2020
IL_000d: ret
2121
// Disassembled in Debug Mode. Press Ctrl+F9 to disassemble in Release Mode.
22-
// Compiling code as Console Application (with top-level statements): succeeded.
22+
// Compiling code as Console Application (with top-level statements): succeeded.

CSharpRepl.Tests/Data/Disassembly/TopLevelProgram.Output.Release.il

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Method begins at RVA 0x2068
1+
// Method begins at RVA 0x2050
22
// Header size: 12
33
// Code size: 11 (0xb)
44
.maxstack 2
@@ -15,4 +15,4 @@ IL_0004: add
1515
IL_0005: call void [System.Console]System.Console::WriteLine(int32)
1616
IL_000a: ret
1717
// Disassembled in Release Mode.
18-
// Compiling code as Console Application (with top-level statements): succeeded.
18+
// Compiling code as Console Application (with top-level statements): succeeded.

CSharpRepl.Tests/Data/Disassembly/TypeDeclaration.Output.Debug.il

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,6 @@
22
{
33
} // end of class <Module>
44

5-
.class private auto ansi sealed beforefieldinit Microsoft.CodeAnalysis.EmbeddedAttribute
6-
extends [System.Runtime]System.Attribute
7-
{
8-
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
9-
01 00 00 00
10-
)
11-
.custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
12-
01 00 00 00
13-
)
14-
// Methods
15-
.method public hidebysig specialname rtspecialname
16-
instance void .ctor () cil managed
17-
{
18-
// Method begins at RVA 0x2050
19-
// Header size: 1
20-
// Code size: 8 (0x8)
21-
.maxstack 8
22-
23-
IL_0000: ldarg.0
24-
IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
25-
IL_0006: nop
26-
IL_0007: ret
27-
} // end of method EmbeddedAttribute::.ctor
28-
29-
} // end of class Microsoft.CodeAnalysis.EmbeddedAttribute
30-
31-
.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.RefSafetyRulesAttribute
32-
extends [System.Runtime]System.Attribute
33-
{
34-
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
35-
01 00 00 00
36-
)
37-
.custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
38-
01 00 00 00
39-
)
40-
.custom instance void [System.Runtime]System.AttributeUsageAttribute::.ctor(valuetype [System.Runtime]System.AttributeTargets) = (
41-
01 00 02 00 00 00 02 00 54 02 0d 41 6c 6c 6f 77
42-
4d 75 6c 74 69 70 6c 65 00 54 02 09 49 6e 68 65
43-
72 69 74 65 64 00
44-
)
45-
// Fields
46-
.field public initonly int32 Version
47-
48-
// Methods
49-
.method public hidebysig specialname rtspecialname
50-
instance void .ctor (
51-
int32 ''
52-
) cil managed
53-
{
54-
// Method begins at RVA 0x2059
55-
// Header size: 1
56-
// Code size: 15 (0xf)
57-
.maxstack 8
58-
59-
IL_0000: ldarg.0
60-
IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
61-
IL_0006: nop
62-
IL_0007: ldarg.0
63-
IL_0008: ldarg.1
64-
IL_0009: stfld int32 System.Runtime.CompilerServices.RefSafetyRulesAttribute::Version
65-
IL_000e: ret
66-
} // end of method RefSafetyRulesAttribute::.ctor
67-
68-
} // end of class System.Runtime.CompilerServices.RefSafetyRulesAttribute
69-
705
.class private auto ansi beforefieldinit Panda
716
extends [System.Runtime]System.Object
727
{
@@ -86,7 +21,7 @@
8621
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
8722
01 00 00 00
8823
)
89-
// Method begins at RVA 0x2069
24+
// Method begins at RVA 0x2050
9025
// Header size: 1
9126
// Code size: 7 (0x7)
9227
.maxstack 8
@@ -104,7 +39,7 @@
10439
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
10540
01 00 00 00
10641
)
107-
// Method begins at RVA 0x2071
42+
// Method begins at RVA 0x2058
10843
// Header size: 1
10944
// Code size: 8 (0x8)
11045
.maxstack 8
@@ -118,7 +53,7 @@
11853
.method public hidebysig specialname rtspecialname
11954
instance void .ctor () cil managed
12055
{
121-
// Method begins at RVA 0x207a
56+
// Method begins at RVA 0x2061
12257
// Header size: 1
12358
// Code size: 8 (0x8)
12459
.maxstack 8
@@ -141,4 +76,4 @@
14176
// Disassembled in Debug Mode. Press Ctrl+F9 to disassemble in Release Mode.
14277
// Compiling code as Console Application (with top-level statements): failed.
14378
// - Program does not contain a static 'Main' method suitable for an entry point
144-
// Compiling code as DLL: succeeded.
79+
// Compiling code as DLL: succeeded.

CSharpRepl.Tests/Data/Disassembly/TypeDeclaration.Output.Release.il

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,6 @@
22
{
33
} // end of class <Module>
44

5-
.class private auto ansi sealed beforefieldinit Microsoft.CodeAnalysis.EmbeddedAttribute
6-
extends [System.Runtime]System.Attribute
7-
{
8-
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
9-
01 00 00 00
10-
)
11-
.custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
12-
01 00 00 00
13-
)
14-
// Methods
15-
.method public hidebysig specialname rtspecialname
16-
instance void .ctor () cil managed
17-
{
18-
// Method begins at RVA 0x2050
19-
// Header size: 1
20-
// Code size: 7 (0x7)
21-
.maxstack 8
22-
23-
IL_0000: ldarg.0
24-
IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
25-
IL_0006: ret
26-
} // end of method EmbeddedAttribute::.ctor
27-
28-
} // end of class Microsoft.CodeAnalysis.EmbeddedAttribute
29-
30-
.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.RefSafetyRulesAttribute
31-
extends [System.Runtime]System.Attribute
32-
{
33-
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
34-
01 00 00 00
35-
)
36-
.custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
37-
01 00 00 00
38-
)
39-
.custom instance void [System.Runtime]System.AttributeUsageAttribute::.ctor(valuetype [System.Runtime]System.AttributeTargets) = (
40-
01 00 02 00 00 00 02 00 54 02 0d 41 6c 6c 6f 77
41-
4d 75 6c 74 69 70 6c 65 00 54 02 09 49 6e 68 65
42-
72 69 74 65 64 00
43-
)
44-
// Fields
45-
.field public initonly int32 Version
46-
47-
// Methods
48-
.method public hidebysig specialname rtspecialname
49-
instance void .ctor (
50-
int32 ''
51-
) cil managed
52-
{
53-
// Method begins at RVA 0x2058
54-
// Header size: 1
55-
// Code size: 14 (0xe)
56-
.maxstack 8
57-
58-
IL_0000: ldarg.0
59-
IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
60-
IL_0006: ldarg.0
61-
IL_0007: ldarg.1
62-
IL_0008: stfld int32 System.Runtime.CompilerServices.RefSafetyRulesAttribute::Version
63-
IL_000d: ret
64-
} // end of method RefSafetyRulesAttribute::.ctor
65-
66-
} // end of class System.Runtime.CompilerServices.RefSafetyRulesAttribute
67-
685
.class private auto ansi beforefieldinit Panda
696
extends [System.Runtime]System.Object
707
{
@@ -81,7 +18,7 @@
8118
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
8219
01 00 00 00
8320
)
84-
// Method begins at RVA 0x2067
21+
// Method begins at RVA 0x2050
8522
// Header size: 1
8623
// Code size: 7 (0x7)
8724
.maxstack 8
@@ -99,7 +36,7 @@
9936
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
10037
01 00 00 00
10138
)
102-
// Method begins at RVA 0x206f
39+
// Method begins at RVA 0x2058
10340
// Header size: 1
10441
// Code size: 8 (0x8)
10542
.maxstack 8
@@ -113,7 +50,7 @@
11350
.method public hidebysig specialname rtspecialname
11451
instance void .ctor () cil managed
11552
{
116-
// Method begins at RVA 0x2078
53+
// Method begins at RVA 0x2061
11754
// Header size: 1
11855
// Code size: 7 (0x7)
11956
.maxstack 8
@@ -135,4 +72,4 @@
13572
// Disassembled in Release Mode.
13673
// Compiling code as Console Application (with top-level statements): failed.
13774
// - Program does not contain a static 'Main' method suitable for an entry point
138-
// Compiling code as DLL: succeeded.
75+
// Compiling code as DLL: succeeded.

CSharpRepl.Tests/DisassemblerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public DisassemblerTests()
3333
public async Task Disassemble_InputCSharp_OutputILAsync(OptimizationLevel optimizationLevel, string testCase)
3434
{
3535
var input = File.ReadAllText($"./Data/Disassembly/{testCase}.Input.txt").Replace("\r\n", "\n");
36-
var expectedOutput = File.ReadAllText($"./Data/Disassembly/{testCase}.Output.{optimizationLevel}.il").Replace("\r\n", "\n");
36+
var expectedOutput = File.ReadAllText($"./Data/Disassembly/{testCase}.Output.{optimizationLevel}.il").Replace("\r\n", "\n").Trim();
3737

3838
var result = await services.ConvertToIntermediateLanguage(input, debugMode: optimizationLevel == OptimizationLevel.Debug);
3939
var actualOutput = Assert

0 commit comments

Comments
 (0)