Skip to content

Commit

Permalink
Add unit-tests. (#43604)
Browse files Browse the repository at this point in the history
Closes #24517
  • Loading branch information
AlekseyTs authored Apr 24, 2020
1 parent 2a4b133 commit 50fc72f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27087,5 +27087,32 @@ .locals init (C.<>c__DisplayClass0_0 V_0, //CS$<>8__locals0
}
");
}

[Fact]
[WorkItem(24517, "https://github.com/dotnet/roslyn/issues/24517")]
public void Issue24517()
{
var source = @"
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
class C
{
static void Main()
{
Expression<Func<ValueTuple<int, int>>> e1 = () => new ValueTuple<int, int>(1, 2);
Expression<Func<KeyValuePair<int, int>>> e2 = () => new KeyValuePair<int, int>(1, 2);

e1.Compile()();
e2.Compile()();

Console.WriteLine(""Done."");
}
}";
var comp = CreateCompilation(
source,
options: TestOptions.ReleaseExe);
CompileAndVerify(comp, expectedOutput: @"Done.");
}
}
}
27 changes: 27 additions & 0 deletions src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23084,6 +23084,33 @@ Module Module1
System.Console.WriteLine(""Done"")
End Sub

End Module
"

Dim comp1 = CreateCompilation(source0, options:=TestOptions.DebugExe)
CompileAndVerify(comp1, expectedOutput:="Done")
End Sub

<Fact>
<WorkItem(24517, "https://github.com/dotnet/roslyn/issues/24517")>
Public Sub Issue24517()
Dim source0 = "
Imports System
Imports System.Collections.Generic
Imports System.Linq.Expressions

Module Module1

Sub Main()
Dim e1 As Expression(Of Func(Of ValueTuple(Of Integer, Integer))) = Function() new ValueTuple(Of Integer, Integer)(1, 2)
Dim e2 As Expression(Of Func(Of KeyValuePair(Of Integer, Integer))) = Function() new KeyValuePair(Of Integer, Integer)(1, 2)

e1.Compile()()
e2.Compile()()

System.Console.WriteLine(""Done"")
End Sub

End Module
"

Expand Down

0 comments on commit 50fc72f

Please sign in to comment.