Skip to content

Commit

Permalink
re-approve
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Sep 3, 2018
1 parent 4c7b4c8 commit 509853b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 36 deletions.
9 changes: 9 additions & 0 deletions Tests/AssemblyWeaver.cs
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions TestsExplicit/ApprovedTests.SimpleClass.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<!!0>()
Expand All @@ -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
Expand Down Expand Up @@ -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 ""
Expand Down Expand Up @@ -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 ""
Expand Down
8 changes: 4 additions & 4 deletions TestsExplicit/ApprovedTests.SimpleClassNoAssert.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<!!0>()
Expand All @@ -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
Expand Down Expand Up @@ -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 ""
Expand Down Expand Up @@ -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 ""
Expand Down
54 changes: 27 additions & 27 deletions TestsExplicit/ApprovedTests.SpecialClass.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/'<CountTo>d__0'::'<>1__state'
IL_0006: stloc.0
Expand Down Expand Up @@ -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/'<SomeMethodAsync>d__1'::'<>1__state'
IL_0006: stloc.0
Expand Down Expand Up @@ -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<string> 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<string> V_4,
[5] class [mscorlib]System.Exception V_5)
IL_0000: ldarg.0
IL_0001: ldfld int32 SpecialClass/'<MethodWithReturnValueAsync>d__2'::'<>1__state'
IL_0006: stloc.0
Expand Down Expand Up @@ -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/'<MethodAllowsNullReturnValueAsync>d__3'::'<>1__state'
IL_0006: stloc.0
Expand Down Expand Up @@ -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/'<NoAwaitCode>d__4'::'<>1__state'
IL_0006: stloc.0
Expand Down Expand Up @@ -625,8 +625,8 @@
.param [2]
// Code size 76 (0x4c)
.maxstack 2
.locals init (valuetype SpecialClass/'<SomeMethodAsync>d__1' V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder V_1)
.locals init ([0] valuetype SpecialClass/'<SomeMethodAsync>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"
Expand Down Expand Up @@ -662,8 +662,8 @@
00 00 )
// Code size 57 (0x39)
.maxstack 2
.locals init (valuetype SpecialClass/'<MethodWithReturnValueAsync>d__2' V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<string> V_1)
.locals init ([0] valuetype SpecialClass/'<MethodWithReturnValueAsync>d__2' V_0,
[1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<string> V_1)
IL_0000: ldloca.s V_0
IL_0002: ldarg.1
IL_0003: stfld bool SpecialClass/'<MethodWithReturnValueAsync>d__2'::returnNull
Expand Down Expand Up @@ -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/'<MethodAllowsNullReturnValueAsync>d__3' V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<string> V_1)
.locals init ([0] valuetype SpecialClass/'<MethodAllowsNullReturnValueAsync>d__3' V_0,
[1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<string> V_1)
IL_0000: ldloca.s V_0
IL_0002: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<!0> valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<string>::Create()
IL_0007: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<string> SpecialClass/'<MethodAllowsNullReturnValueAsync>d__3'::'<>t__builder'
Expand All @@ -718,8 +718,8 @@
34 00 00 ) // 4..
// Code size 49 (0x31)
.maxstack 2
.locals init (valuetype SpecialClass/'<NoAwaitCode>d__4' V_0,
valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int32> V_1)
.locals init ([0] valuetype SpecialClass/'<NoAwaitCode>d__4' V_0,
[1] valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int32> V_1)
IL_0000: ldloca.s V_0
IL_0002: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<!0> valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int32>::Create()
IL_0007: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<int32> SpecialClass/'<NoAwaitCode>d__4'::'<>t__builder'
Expand Down
2 changes: 1 addition & 1 deletion TestsExplicit/TestsExplicit.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp2.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
Expand Down

0 comments on commit 509853b

Please sign in to comment.