[closes gh-119] Added test for F#'s notnull (fixed by previous commit).

This commit is contained in:
Andrey Shchekin 2017-06-25 20:03:39 +12:00
Родитель 2dfaa3f749
Коммит 68fdcb3244
3 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -65,6 +65,8 @@ namespace SharpLab.Tests {
[Theory]
[InlineData("FSharp.EmptyType.fs2il")]
[InlineData("FSharp.SimpleMethod.fs2cs")]
// https://github.com/ashmind/SharpLab/issues/119
[InlineData("FSharp.NotNull.fs2cs")]
public async Task SlowUpdate_ReturnsExpectedDecompiledCode_ForFSharp(string resourceName) {
var data = TestData.FromResource(resourceName);
var driver = await NewTestDriverAsync(data);

Просмотреть файл

@ -0,0 +1,36 @@
open System
type C() =
member __.notNull x = not (isNull x)
#=>
using Microsoft.FSharp.Core;
using System;
using System.Reflection;
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: FSharpInterfaceDataVersion(2, 0, 0)]
[CompilationMapping(SourceConstructFlags.Module)]
public static class _
{
[CompilationMapping(SourceConstructFlags.ObjectType)]
[Serializable]
public class C
{
public C() : this()
{
}
public bool notNull<a>(a x) where a : class
{
return ((x == null) ? 1 : 0) == 0;
}
}
}
namespace <StartupCode$_>
{
internal static class $_
{
}
}

Просмотреть файл

@ -13,6 +13,7 @@
<None Remove="TestCode\Ast\StructuredTrivia.cs2ast" />
<None Remove="TestCode\Constructor.BaseCall.cs2cs" />
<None Remove="TestCode\FSharp\EmptyType.fs2il" />
<None Remove="TestCode\FSharp\NotNull.fs2cs" />
<None Remove="TestCode\FSharp\SimpleMethod.fs2cs" />
<None Remove="TestCode\JitAsm\ArrayElement.cs2asm" />
<None Remove="TestCode\JitAsm\AsyncRegression.cs2asm" />
@ -42,6 +43,7 @@
<EmbeddedResource Include="TestCode\Ast\StructuredTrivia.cs2ast" />
<EmbeddedResource Include="TestCode\Constructor.BaseCall.cs2cs" />
<EmbeddedResource Include="TestCode\FSharp\EmptyType.fs2il" />
<EmbeddedResource Include="TestCode\FSharp\NotNull.fs2cs" />
<EmbeddedResource Include="TestCode\FSharp\SimpleMethod.fs2cs" />
<EmbeddedResource Include="TestCode\JitAsm\GenericMethodWithAttribute.fs2asm" />
<EmbeddedResource Include="TestCode\JitAsm\OpenGenerics.cs2asm" />