From 509853bcd0a763e307645693939b765ca9c95f1b Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 3 Sep 2018 21:09:07 +1000 Subject: [PATCH] re-approve --- Tests/AssemblyWeaver.cs | 9 ++++ .../ApprovedTests.SimpleClass.approved.txt | 8 +-- ...ovedTests.SimpleClassNoAssert.approved.txt | 8 +-- .../ApprovedTests.SpecialClass.approved.txt | 54 +++++++++---------- TestsExplicit/TestsExplicit.csproj | 2 +- 5 files changed, 45 insertions(+), 36 deletions(-) diff --git a/Tests/AssemblyWeaver.cs b/Tests/AssemblyWeaver.cs index ed0fc88a..68f0563d 100644 --- a/Tests/AssemblyWeaver.cs +++ b/Tests/AssemblyWeaver.cs @@ -1,6 +1,10 @@ using System.Collections.Generic; using System.Reflection; using System.Xml.Linq; +#if (NET472) +using ApprovalTests.Core; +using ApprovalTests.Reporters; +#endif using Fody; #pragma warning disable 618 @@ -10,6 +14,11 @@ public static class AssemblyWeaver static AssemblyWeaver() { +#if (NET472) + //TODO: this works around https://github.com/approvals/ApprovalTests.Net/issues/159 + var reporters = (IEnvironmentAwareReporter[])FrameworkAssertReporter.INSTANCE.Reporters; + reporters[2] = XUnit2Reporter.INSTANCE; +#endif var weavingTask = new ModuleWeaver { Config = new XElement("NullGuard", diff --git a/TestsExplicit/ApprovedTests.SimpleClass.approved.txt b/TestsExplicit/ApprovedTests.SimpleClass.approved.txt index f27cd2b4..454e4871 100644 --- a/TestsExplicit/ApprovedTests.SimpleClass.approved.txt +++ b/TestsExplicit/ApprovedTests.SimpleClass.approved.txt @@ -450,7 +450,7 @@ { // Code size 59 (0x3b) .maxstack 2 - .locals init (!!T V_0) + .locals init ([0] !!T __var_0) IL_0000: ldarg.1 IL_0001: brtrue.s IL_001d IL_0003: call !!0 [mscorlib]System.Activator::CreateInstance() @@ -463,7 +463,7 @@ IL_0016: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) IL_001b: throw IL_001c: ret - IL_001d: ldloca.s V_0 + IL_001d: ldloca.s __var_0 IL_001f: initobj !!T IL_0025: ldloc.0 IL_0026: dup @@ -565,7 +565,7 @@ { // Code size 44 (0x2c) .maxstack 2 - .locals init (string V_0) + .locals init ([0] string returnValue) IL_0000: ldnull IL_0001: stloc.0 IL_0002: ldstr "" @@ -614,7 +614,7 @@ { // Code size 44 (0x2c) .maxstack 2 - .locals init (string V_0) + .locals init ([0] string returnValue) IL_0000: ldnull IL_0001: stloc.0 IL_0002: ldstr "" diff --git a/TestsExplicit/ApprovedTests.SimpleClassNoAssert.approved.txt b/TestsExplicit/ApprovedTests.SimpleClassNoAssert.approved.txt index f27cd2b4..454e4871 100644 --- a/TestsExplicit/ApprovedTests.SimpleClassNoAssert.approved.txt +++ b/TestsExplicit/ApprovedTests.SimpleClassNoAssert.approved.txt @@ -450,7 +450,7 @@ { // Code size 59 (0x3b) .maxstack 2 - .locals init (!!T V_0) + .locals init ([0] !!T __var_0) IL_0000: ldarg.1 IL_0001: brtrue.s IL_001d IL_0003: call !!0 [mscorlib]System.Activator::CreateInstance() @@ -463,7 +463,7 @@ IL_0016: newobj instance void [mscorlib]System.InvalidOperationException::.ctor(string) IL_001b: throw IL_001c: ret - IL_001d: ldloca.s V_0 + IL_001d: ldloca.s __var_0 IL_001f: initobj !!T IL_0025: ldloc.0 IL_0026: dup @@ -565,7 +565,7 @@ { // Code size 44 (0x2c) .maxstack 2 - .locals init (string V_0) + .locals init ([0] string returnValue) IL_0000: ldnull IL_0001: stloc.0 IL_0002: ldstr "" @@ -614,7 +614,7 @@ { // Code size 44 (0x2c) .maxstack 2 - .locals init (string V_0) + .locals init ([0] string returnValue) IL_0000: ldnull IL_0001: stloc.0 IL_0002: ldstr "" diff --git a/TestsExplicit/ApprovedTests.SpecialClass.approved.txt b/TestsExplicit/ApprovedTests.SpecialClass.approved.txt index 4bac32ef..1cb1e49b 100644 --- a/TestsExplicit/ApprovedTests.SpecialClass.approved.txt +++ b/TestsExplicit/ApprovedTests.SpecialClass.approved.txt @@ -44,8 +44,8 @@ .override [mscorlib]System.Collections.IEnumerator::MoveNext // Code size 92 (0x5c) .maxstack 3 - .locals init (int32 V_0, - int32 V_1) + .locals init ([0] int32 V_0, + [1] int32 V_1) IL_0000: ldarg.0 IL_0001: ldfld int32 SpecialClass/'d__0'::'<>1__state' IL_0006: stloc.0 @@ -211,10 +211,10 @@ .override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext // Code size 172 (0xac) .maxstack 3 - .locals init (int32 V_0, - class SpecialClass/'<>c__DisplayClass1_0' V_1, - valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_2, - class [mscorlib]System.Exception V_3) + .locals init ([0] int32 V_0, + [1] class SpecialClass/'<>c__DisplayClass1_0' 'CS$<>8__locals0', + [2] valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_2, + [3] class [mscorlib]System.Exception V_3) IL_0000: ldarg.0 IL_0001: ldfld int32 SpecialClass/'d__1'::'<>1__state' IL_0006: stloc.0 @@ -342,12 +342,12 @@ .override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext // Code size 201 (0xc9) .maxstack 3 - .locals init (int32 V_0, - string V_1, - class SpecialClass/'<>c__DisplayClass2_0' V_2, - string V_3, - valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1 V_4, - class [mscorlib]System.Exception V_5) + .locals init ([0] int32 V_0, + [1] string V_1, + [2] class SpecialClass/'<>c__DisplayClass2_0' 'CS$<>8__locals0', + [3] string V_3, + [4] valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter`1 V_4, + [5] class [mscorlib]System.Exception V_5) IL_0000: ldarg.0 IL_0001: ldfld int32 SpecialClass/'d__2'::'<>1__state' IL_0006: stloc.0 @@ -460,10 +460,10 @@ .override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext // Code size 147 (0x93) .maxstack 3 - .locals init (int32 V_0, - string V_1, - valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_2, - class [mscorlib]System.Exception V_3) + .locals init ([0] int32 V_0, + [1] string V_1, + [2] valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter V_2, + [3] class [mscorlib]System.Exception V_3) IL_0000: ldarg.0 IL_0001: ldfld int32 SpecialClass/'d__3'::'<>1__state' IL_0006: stloc.0 @@ -556,9 +556,9 @@ .override [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext // Code size 56 (0x38) .maxstack 2 - .locals init (int32 V_0, - int32 V_1, - class [mscorlib]System.Exception V_2) + .locals init ([0] int32 V_0, + [1] int32 V_1, + [2] class [mscorlib]System.Exception V_2) IL_0000: ldarg.0 IL_0001: ldfld int32 SpecialClass/'d__4'::'<>1__state' IL_0006: stloc.0 @@ -625,8 +625,8 @@ .param [2] // Code size 76 (0x4c) .maxstack 2 - .locals init (valuetype SpecialClass/'d__1' V_0, - valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder V_1) + .locals init ([0] valuetype SpecialClass/'d__1' V_0, + [1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder V_1) IL_0000: ldarg.1 IL_0001: brtrue.s IL_0013 IL_0003: ldstr "nonNullArg" @@ -662,8 +662,8 @@ 00 00 ) // Code size 57 (0x39) .maxstack 2 - .locals init (valuetype SpecialClass/'d__2' V_0, - valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 V_1) + .locals init ([0] valuetype SpecialClass/'d__2' V_0, + [1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 V_1) IL_0000: ldloca.s V_0 IL_0002: ldarg.1 IL_0003: stfld bool SpecialClass/'d__2'::returnNull @@ -692,8 +692,8 @@ 63 3E 64 5F 5F 33 00 00 ) // c>d__3.. // Code size 49 (0x31) .maxstack 2 - .locals init (valuetype SpecialClass/'d__3' V_0, - valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 V_1) + .locals init ([0] valuetype SpecialClass/'d__3' V_0, + [1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 V_1) IL_0000: ldloca.s V_0 IL_0002: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() IL_0007: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 SpecialClass/'d__3'::'<>t__builder' @@ -718,8 +718,8 @@ 34 00 00 ) // 4.. // Code size 49 (0x31) .maxstack 2 - .locals init (valuetype SpecialClass/'d__4' V_0, - valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 V_1) + .locals init ([0] valuetype SpecialClass/'d__4' V_0, + [1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 V_1) IL_0000: ldloca.s V_0 IL_0002: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() IL_0007: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 SpecialClass/'d__4'::'<>t__builder' diff --git a/TestsExplicit/TestsExplicit.csproj b/TestsExplicit/TestsExplicit.csproj index eb80a676..4e55c348 100644 --- a/TestsExplicit/TestsExplicit.csproj +++ b/TestsExplicit/TestsExplicit.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net472;netcoreapp2.0 true false full